refactoring + additional comments