Some improvements and fixes.