refactoring #1
refactoring #2
implemented comments