     }
     
     func setColorBuffer() {
+        
+        guard let colorArgs = _colorArgs else {
+            print("Warning: The colorArgs buffer was nil. Abouting")
+            return
+        }
+        
         let nextBuffer = (_currentColorBuffer + 1) % _numberShaderBuffers
         _currentColorBuffer += 1
 
         if _currentColorConvolution.count == 9 {
-            _colorArgs[nextBuffer].yuvToRGB?.set(
+            colorArgs[nextBuffer].yuvToRGB?.set(
                 (
                     (_currentColorConvolution[0], _currentColorConvolution[1], _currentColorConvolution[2]),
                     (_currentColorConvolution[3], _currentColorConvolution[4], _currentColorConvolution[5]),

        bilinear.label = "bilinear"
        bilinear.minFilter = .Linear
        bilinear.magFilter = .Linear
        _samplerStates = [nearest, bilinear].map {self._device!.newSamplerStateWithDescriptor($0)}


        
        // create the command queue
        _commandQueue = _device!.newCommandQueue()
    }
    
    // create a pipeline state descriptor for a vertex/fragment shader combo
    func pipelineStateFor(label label:String!, fragmentShader:String!, vertexShader: String?) -> (MTLRenderPipelineState?, MTLRenderPipelineReflection?) {
        if let fragmentProgram = _shaderLibrary.newFunctionWithName(fragmentShader), let vertexProgram = _shaderLibrary.newFunctionWithName(vertexShader ?? "defaultVertex") {
            let pipelineStateDescriptor = MTLRenderPipelineDescriptor()
            pipelineStateDescriptor.label = label
            pipelineStateDescriptor.vertexFunction = vertexProgram

                )
            )
        } else {
            colorArgs[nextBuffer].yuvToRGB?.clearIdentity()
        }

    }
    
    func setFilterBuffer() {
        
        guard let filterArgs = _filterArgs else {
            print("Warning: The filterArgs buffer was nil. Abouting")
            return
        }
        
        let nextBuffer = (_currentFilterBuffer + 1) % _numberShaderBuffers
        _currentFilterBuffer += 1

        let currentBuffer = filterArgs[nextBuffer]
        if invertScreen {
            currentBuffer.primaryColor?.inverseColor = primaryColor
            currentBuffer.secondaryColor?.inverseColor = secondaryColor
