Refactored code from BestHospitals to a common file that will be used by related R scripts