[#72] Major refactoring, need to clean up tests