Cosmetic improvements and some bug fixing.