Cleaned up the covariate mapping function