Lot's of modifications and fixes