abstracting common code