Began work on the backend for agents.

And made some other minor changes.