Cleanup of dispatching code.