Refactored code from last push