Adding comments, minor fixes and refactoring checkpoint