several memory and speed enhancements