refactoring and package organization