major hack work. Fixed a bunch of little bugs