Changed method for finding functions fixes #7723 fixes #7736

The earlier method of finding func was incomplete. This new method is more robust and less likely to fail. This method is still in progress.
Thanks, Updated