Last commit before send: add comments and some refactoring