I'm sure its similar a bit similar (kinda, not really. )
If you want help, I can look at the code for it.