refactored code to meet styling guide