Suppressing digital pin switching noise

Yes. It can be tricky. Working through it bit by bit.