updated readme with factory function