Added some performance patches and documentation