Fixed a few bugs but lots more to fix