cleaned up code; ready for submission