abstract common code