added fortran routines for some slow bits