cellContents :: Img -> CellCoords -> (Int,Int) -> [ ((Word8,Word8,Word8), Int) ]
cellContents img (xcs, ycs, l) (x,y) = reverse . sortBy (comparing snd) . map (head &&& length) . group $ sortedPixels
  where (ccx, ccy) = (xcs !! x, ycs !! y)
        range = [-l `div` 2 .. l `div` 2]
        coords = [ (ccx + i, ccy + j) | i <- range, j <- range ]
        pixels = map (pixAt img) coords
        sortedPixels = sort pixels
cellContents :: Img -> CellCoords -> (Int,Int) -> [ ((Word8,Word8,Word8), Int) ]
cellContents img (xcs, ycs, l) (x,y) = reverse . sortBy (comparing snd) . map (head &&& length) . group $ sortedPixels
  where (ccx, ccy) = (xcs !! x, ycs !! y)
        range = [-l `div` 2 .. l `div` 2]
        coords = [ (ccx + i, ccy + j) | i <- range, j <- range ]
        pixels = map (pixAt img) coords
        sortedPixels = sort pixels
cellContents img (xcs, ycs, l) (x,y) = reverse . sortBy (comparing snd) . map (head &&& length) . group $ sortedPixels
  where (ccx, ccy) = (xcs !! x, ycs !! y)
        range = [-l `div` 2 .. l `div` 2]
        coords = [ (ccx + i, ccy + j) | i <- range, j <- range ]
        pixels = map (pixAt img) coords
        sortedPixels = sort pixels