commenting, minor refactoring