a bit of clean up and comments