Adding factory logic