What happens if you run your code in PDE ?
Do you get any hints in the editor pane and/or console window ?
Have you tried to follow these hints?
I would recommend that you go through your code (line by line) and try to add comments what each line is doing or what it should doing and what possible went wrong.
Don’t hesitate to come back if you have concrete questions…