anchor.diff:              let rows = matrix.GetLength(0)
               let cols = matrix.GetLength(1)
   
  -            let d_max = rows + cols
  +            let dMax = rows + cols
   
               __syncthreads()
  -            for d in 0..d_max do
  -                let m_max = m_maxs.[d]
  +            for d in 0..dMax do
  +                let mMax = mMaxs.[d]
                   let mutable m = start
  -                while m <= m_max do
  -                    let i = get_i d m (rows - 1)
  -                    let j = get_j d m (rows - 1)
  +                while m <= mMax do
  +                    let i = getI d m (rows - 1)
  +                    let j = getJ d m (rows - 1)
   
                       // Avoid the first row and first column of the matrix because they are reserved for the sequences in the form of 0s.
                       if i <> 0 && j <> 0 then
  -                        matrix.[i,j] <- prim_best_trace matrix.[i-1,j-1] matrix.[i,j-1] matrix.[i-1,j] fst_seq.[i-1] snd_seq.[j-1] 
  +                        matrix.[i,j] <- bestTrace matrix.[i-1,j-1] matrix.[i,j-1] matrix.[i-1,j] fstSeq.[i-1] sndSeq.[j-1] 
   
                       m <- m + stride
                   __syncthreads()
               __syncthreads()
   
   
  -        let transform_kernel = <@ kernel @> |> Compiler.makeKernel
  -
  -        let gpu_cell_matrix (fst_seq:int[]) (snd_seq:int[]) =
  +        let transformKernel = <@ kernel @> |> Compiler.makeKernel
  +
  +        let gpuCellMatrix (fst_seq:int[]) (snd_seq:int[]) =
               let rows, cols = fst_seq.Length + 1, snd_seq.Length + 1
   
               let d_max = rows + cols - 1
               let d_maxs = [|for d in 0..d_max -> d|]
  -            let m_maxs = d_maxs |> Array.map (fun d -> max_diag_cell d rows cols)
  +            let m_maxs = d_maxs |> Array.map (fun d -> maxDiagCell d rows cols)
   
               let gpu = Gpu.Default
  -            let fst_seq_gpu = gpu.Allocate(fst_seq)
  -            let snd_seq_gpu = gpu.Allocate(snd_seq)
  -            let m_maxs_gpu = gpu.Allocate(m_maxs)
  -            let matrix_gpu = gpu.Allocate<prim_cell>(rows, cols)
  +            let fstSeqGpu = gpu.Allocate(fst_seq)
  +            let sndSeqGpu = gpu.Allocate(snd_seq)
  +            let mMaxsGpu = gpu.Allocate(m_maxs)
  +            let matrixGpu = gpu.Allocate<Cell>(rows, cols)
   
               let lp = LaunchParam(1, 512)
  -            gpu.Launch transform_kernel lp matrix_gpu fst_seq_gpu snd_seq_gpu m_maxs_gpu
  -
  -            let matrix = Gpu.CopyToHost(matrix_gpu)
  -
  -            Gpu.Free(fst_seq_gpu)
  -            Gpu.Free(snd_seq_gpu)
  -            Gpu.Free(m_maxs_gpu)
  -            Gpu.Free(matrix_gpu)
  +            gpu.Launch transformKernel lp matrixGpu fstSeqGpu sndSeqGpu mMaxsGpu
  +
  +            let matrix = Gpu.CopyToHost(matrixGpu)
  +
  +            Gpu.Free(fstSeqGpu)
  +            Gpu.Free(sndSeqGpu)
  +            Gpu.Free(mMaxsGpu)
  +            Gpu.Free(matrixGpu)
   
               matrix
   
       module ParallelSmithWaterman =
           let run (fstSeq:string) (sndSeq:string) =
  -            let fstSeqPrim = fstSeq |> string_to_char_ints
  -            let sndSeqPrim = sndSeq |> string_to_char_ints
  -            let cell_matrix = ParallelMatrix.gpu_cell_matrix fstSeqPrim sndSeqPrim
  -            let i, j = index_of_max_in_matrix_TRACE cell_matrix
  +            let fstSeqPrim = fstSeq |> stringToCharInts
  +            let sndSeqPrim = sndSeq |> stringToCharInts
  +            let cell_matrix = ParallelMatrix.gpuCellMatrix fstSeqPrim sndSeqPrim
  +            let i, j = indexOfMaxInMatrix cell_matrix
   
               let alignment = traceBackPrimitive fstSeqPrim sndSeqPrim i j List.Empty List.Empty cell_matrix
   
  
positive.code:     // Conversion functions
  
      /// Character array to integer array
      let chars_to_ints (chars:char[]) =
          Array.map (fun c -> int c) chars
  
      /// Character array to string
  
negative.code:         Array.map (fun myInt -> if myInt = -1 then '-' else char myInt) ints
  
      /// String to integer array.
      let stringToCharInts (my_string:string) =
          let exploded = explode my_string
          exploded |> charsToInts    
              
  
      // Alignment functions
  
      /// Primitive version of TraceScore.
      [<Struct>]
      type TraceScore =
          val Value : int
          val TraceType : byte
  
          // TraceType LEGEND:
          // 0 : NoTrace
          // 1 : Diagonal
          // 2 : Horizontal
          // 3 : Vertical
          
          [<ReflectedDefinition>]
          new (value, traceType) = {Value = value; TraceType = traceType}
  
      /// Primitive version of Cell.
      [<Struct>]
      type Cell = 
          val M : TraceScore
          val X : TraceScore
          val Y : TraceScore
  
          [<ReflectedDefinition>]
          new (m, x, y) = {M = m; X = x; Y = y}
  
      /// Primitive version of AddFloatToTrace
      [<ReflectedDefinition>]
      let AddFloatToTrace (ts:TraceScore) (opc:int) =
          ts.Value + opc
  
      /// Primitive version of DiagonalCost
      [<ReflectedDefinition>]
      let diagonalCost (cell:Cell) (item1:int) (item2:int) =
          let sim' = if item1 = item2 then 5 else -4
          let mM = AddFloatToTrace cell.M sim' 
          let mY = AddFloatToTrace cell.Y sim' 
          let mX = AddFloatToTrace cell.X sim'             
          max mM mY |> max mX |> max 0
  
      /// Primitive version of HorizontalCost
      [<ReflectedDefinition>]
      let horizontalCost (cell:Cell) = 
          let xM = AddFloatToTrace cell.M -5
          let xX = AddFloatToTrace cell.X -1
          max xM xX |> max 0
  
      /// Primitive version of VerticalCost
      [<ReflectedDefinition>]
      let verticalCost (cell:Cell) =
          let yM = AddFloatToTrace cell.M -5
          let yY = AddFloatToTrace cell.Y -1
          max yM yY |> max 0
  
      /// Primitive function for calculating the best cost.
      [<ReflectedDefinition>]
      let bestTrace m x y seq1Char seq2Char =
          let mCost = diagonalCost m seq1Char seq2Char
  
          let xCost = horizontalCost x
          let x' = new TraceScore(xCost, 2uy)
  
          let yCost = verticalCost y
          let y' = new TraceScore(yCost, 3uy)
  
          let mutable bestCost = xCost
          let mutable bestTraceType = 2uy
  