Add a ton of error checks for Layout.