removing ef and some refactoring