Switch unit testing from catch to gtest + misc bug fixes