Made some changes. Now it saves into a XML. Changed the way gates were stored. Gates now set their output according to their entries and kind of gate.