Fixed bugs, verified behavior matches requirements. Integrated
fixes from Skylor.