reformatted
some refactoring