separate common code