As a follow-up:
If you have questions about code... prepare your question by posting your code to one of the code sharing sites like:
Hastebin Pastebin Gist
... Just a few examples...