Moved some functions around in order to ensure the client is always
authenticated. SendToForm and SendToUrl both appear to be working.