Cleaned up some code for readability