Refactored code and packages