Refactoring core classes to fit code standards, updating tests to work with dependency injection without globals