Comments and some refactoring