code cleanups
minor refactoring