Small changes, mainly from PeterK