quesetion about interfacing with rotary switch

Just thought of another way to do what you are after last night. Put 1K resistors between each of the pins, with the last connected to ground and the last on the other end connected to +5V. Then take the common and connect it to an analogue input and read the voltage.

interestingly if I touch or even put my hand near the ground wire or input wires, it then reads it correctly again.

Enable the pull upp resistors on you pin inputs by doing a :-
digitalWrite(pin, HIGH);
On all your input pins during the setup.