just some comments in code, re-arranged a bit