added unit tests and gtest hooks