Added factory method and unit test