some refactoring fixes