fixes to subroutines, increased max priority