refactoring, added google unit tests