Refactor code to follow conventions