+1 this is really confusing code