I can't make head nor tail of what this if/else is trying to do...