lots of clean up and simplification