Comments and slight refactoring