package refactoring and cleanup