Fixed a whole LOT of bugs.