Factory design pattern added.