I sign changed in te_pair.py so it calculates correct q_x for N and P type, made other changes too