What tutorial were you looking at? That looks positively unsightly, and I can understand why you are having trouble. I would recommend starting from scratch, and using a different approach. When you do implement code you see from others, make sure to know what it does before you add it. That way you're able to work with the code if you run into problems. What I usually suggest is the method outlined in the following link (I find it the clearest method as well as most dynamic way of controlling your player).
http://game-editor.com/State_Method