optimizing layout