massiv refactoring + test