major cleanup after earlier refactoring