added logic to invert pin levels