various enhancements and fixes