Removed a small bug and improved efficiency a tad

_updateHistroy() changed to _updateHistory()
Commented out a few unnecessary statements
Introduced break statements to prevent redundant iterations in llops of determining gate output