Add a few optimizations
Merge remote-tracking branch 'upstream/master'