Lots of fixes and some additions.