Add logic to allow layout to be nil