Better filtering of possible subroutines

Much faster now!