Some improvements and fixes
