It's ugly, undocumented and you shouldn't read the code. It works, though!