Thank you fizzlemizz for correcting some of my mistakes- I'll install that debugger and go through it soon to find the others! Consider my original question resolved as I don't want to bother you all anymore with fixing my code for me in your own time
EDIT:
I managed to iron out the bugs and have a working addon now, thank you so much! I don't plan on sharing it widely except with friends, but I've added credit at the top to all of you just in case.