small refactoring, cleanup code