moved out if statement from renderLayerControl method