Package refactoring and a bit of cleanup