Fundamental refactor and modernization. This version serves as the foundation for further work on the codebase.