layout algorithm changes