Refactored code to match checkstyle