Swap in new functions.

This is rapidly becoming very messy...