Hi Taz.
I see you have 2 ports as inputs, what is connected to them? PortB.7, I see no reference to in code, possibly my bad eyesight, but if open as input might allow "gremlins" to leak in.