Added NOT gates and backfeeding.