Added some optimization bits and pieces.