some refactoring; undo improvements