Various enhancements and fixes