Working version without lines connecting gates.