Cleaner way of wrapping and exporting functions

The previous code relied on side effects to add wrapped functions to exported functions. The wrapped functions are now explicitly appended to the `functions` object.