comments and a bit of clean up / refactor