Layout generation - final version