Refactored code to separate package