Refactored some code to match checkstyle