Calculate the max alpha value at the end; it's less work this way