Minor package refactoring and added unit tests.