Some fixes and new ways to optimize.