This should help explain a few things
I KNOW this code can be improved, I just didn't have the time to make it all purdy.