More comments and a little more refactoring