I don't know how this code is working, but it is.  #ugly