Consolidate function wrapping into a TraceKit.wrap()

This removes a lot of duplicate code.
Refs #3 as well.