Removed redundant state changes and unbinds for a 5% performance gain.