refactoring, notes in comments