Improve how models are cached and clean up YUI usage on server.

Closes #12