some package clean up and refactoring