better naming, some minor refactoring