A lot of good fixes according to Paul's suggestions