Refactored some of the code

Minor changes, no logic / style