More code cleanup, added gtest, wrote rudimentary tests for parsing.