added factory tests, fixed factory to return app