refactored code and packages