Switched to CMake; added gtest; started rewrite