Improve performance

We've made a few performance tweaks here. We've also refactored the
groups dropdown to be much faster than it was before.