how on earth does this function work....