Added factory, added tests, refactored deps