I would put the if before and collect in the else so that the logic is clearer.