refactoring + fix testapp