Very nice optimization but doesnt handle superposition states yet