rearrange handling example for readability