cleaned up code for review