first step
some refactoring