small cleanup and refactoring changes