some cleanup, refactoring, etc