some enhancements and bug fixes