Lot's of fixes and improvements