cleaned up code for better readability