Cleaned up my code to make it more readable