a lot of fixes and enhancements, commit for review