Checking in a bunch of changes.
Still a bit messy.