Major overhaul.

This thing doesn't suck now.