Cleaning up the code some