optimize some layouts