Not immediately apparent what this is attempting to do - is there a more succinct way to do this?