consolidated if statement for layout