Pass in require properly to factory