Nice one!  This is not that clear from looking at the code :-)