Adding comments, some refactoring
Some refactoring