Changed method for finding functions [WIP]

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.