first version of subroutine finder

very hacky and not too smart, but it
shortens introbattle nicely!