How are you trying to debug the code to find out why it is not doing what you want it to do?

Can you copy and paste here some output and add some comments explaining what the program did that was...