Enormous commit with base classes. Does not run atm.
Ammending last commit with missing files.