performed some refactoring