Quite probably the final commit! yay!

More fixes and stuff. Tests too.