Added factory definition to stand-alone example.