start simplifying and cleaning up code