some refactoring complete