If the layout isn't prepared, then prepare it when it's about to be used
Merge pull request #325 from mattjgalloway/prepare-layout

If the layout isn't prepared, then prepare it when it's about to be used