did some refactoring