Major refactoring - unit tests all green