Cleaning up code to improve readability