There's a better way to hook up your switches to get rid of noise issues. Use 24V.
http://www.cncbuildingblocks.com/sourceoptoinput.html