Adding more comments, refactoring