refactoring

* move some more code in a new file