Optimizing general layout