convert the Goal-class to the factory pattern