Started working on invert.py and fixed a few programs related to that.