Prettified & refactored code