Decently cleaned up, still more work to do.