1. Refined layout code