Use proper factory method
Merge pull request #542 from andrerod/dev

Use proper factory method