add comments, tiny refactoring