Changes to logic gates code

Some basic changes, before we try and shift to classes