Lots of small fixes and additions