Simplified function, additionally now works with member pointers

See #855