Fixed a bunch of bugs and now 11 new test cases work.

Signed-off-by: Jason Kuster <unexpectedapocalypse@gmail.com>