Use factory function
Merge pull request #9 from rhattersley/factory-function

Use factory function