Cleaning up code as per cookbook style guide