adapted factory design