Changed layout algo