A better way to handle conditional layout changes