Changed code for logic gates

Some changes before working on separate classes