Rearrange to imprve performance