Rearrange logic - maybe a bit clearer