added tests and fixed app