it's just a small portion of that code. Would it be ok if I sent you bigger chunk? Only to implement the tool, the buttons work, so I think I may be missing something rather small.
EDIT: I think I managed to fix it! I will continue checking if it's wrong, I will ask again, if that's ok with you. I also donated few $. Even if it's not much, I wanted to say thank you in some way :)