Updated fortran code