refactoring, more comments in code