You haven't read the forum instructions. You need to post the code in line, inside a post, and using the code tags to format it.
Also, you left questions unanswered.
...and, according to the code that I found by following the link anyway, your switch wiring now needs to be modified, as explained in reply #6.
Another thing, we don't really have a description of the problem, other than "the data is messy" or "issues". Can you provide a more specific description of the potentiometer behaviour? Also, did your changes to the code change the pot behaviour?