Initial performance optimizations.  Still needs to be tested.  WIP