Some formatting, a few bugs.