Fixed function matching, now really finds the functions we need.
Removed unneeded debug messages and "but this should work better like this"-stuff that is ugly.