Added resource factory with tests