moved some routines to extraroutine.f90