cleaned up code for submission