Please wrap your code in the
tags to get the formatting

Define don't know how it works. I presume this is not your code...then study the lines in the code, step through it with a debugger, or...