Given an smooth function K<0 we prove a result by Berger, Kazhdan and others that in every conformal class there exists a metric which attains this function as its Gaussian curvature for a compact Riemann surface of genus g>1. We do so by minimizing an appropriate functional using elementary analysis. In particular for K a negative constant, this provides an elementary proof of the uniformization theorem for compact Riemann surfaces of genus g>1.