Cleaning up the code for readability