Another giant refactoring. Cleaning things up. Tests should be placed in shadow hierarchy of the actual production code.