Moved a variable declaration in BuildLayout() so it can be properly initialized.