not sure about all the commented out code at the bottom. but putting in a somewhat clean state