Cleaning up code so that a pull request can be made