minor refactoring; cleaned up stuff