package refactoring and unit tests