implementing factory and palette