An analysis of the quality and cost of repeat prescriptions