add unit tests. Update class to comply with tests.