finally updated quantum code.