code enhancements
enhancements merged with latest changes