Replaced fortran code with up to date version.