Updated for gfortran on Titan. Still buggy version