Some enhancements and fixes