Adding some comments, and made some refactoring