added isInputPin/isOutputPin for cleaner logic