Rename file to factory.hh and finish the implementation