Ironed out some bugs.

Mostly stuff I forgot about due to interruptions.