Lots of little fixes