Merge pull request #1848 from larsbrinkhoff/again_with_the_fortran

Improve FORTRAN heuristic.