Some minor improvements and fixes