Refactored code to align to learn code standard