Re-write layout code.