Add some comments (more to come) and a little cleanup