diff --git a/arrayfire.cabal b/arrayfire.cabal
--- a/arrayfire.cabal
+++ b/arrayfire.cabal
@@ -1,5 +1,5 @@
 name:                arrayfire
-version:             0.5.0.0
+version:             0.5.1.0
 synopsis:            Haskell bindings to the ArrayFire general-purpose GPU library
 homepage:            https://github.com/arrayfire/arrayfire-haskell
 license:             BSD3
@@ -95,8 +95,7 @@
       /opt/arrayfire/include
     extra-lib-dirs:
       /opt/arrayfire/lib
-    ld-options:
-      -Wl,-rpath /opt/arrayfire/lib
+      /opt/arrayfire/lib64
 
 executable main
   hs-source-dirs:
diff --git a/exe/Main.hs b/exe/Main.hs
--- a/exe/Main.hs
+++ b/exe/Main.hs
@@ -5,87 +5,86 @@
 module Main where
 
 import ArrayFire
-import Control.Concurrent
-import Control.Exception
 
-import Prelude            hiding (sum, product)
--- import GHC.RTS
+import Control.Monad (unless)
+import Prelude       hiding (sum, product, mod, abs, cos, sin)
 
-foreign import ccall safe "test_bool"
-  testBool :: IO ()
+main :: IO ()
+main = do
+  print $ constant @Double [10] 3.33
+  window <- createWindow 800 600 "hey"
+  let x = iota [200,1] [1,200] / 1000
+      y = iota [1,200] [200,1] / 1000
+  go window (1 :: Array Float) x y
+    where
+      go window t x y = do
+        let z = 10*x*(-abs(y)) * cos(x*x*(y+t))+sin(y*(x+t))-1.5
+        drawSurface window x y z (Cell (-1) (-1) "there" ColorMapDefault)
+        closed <- isWindowClosed window
+        unless closed $ go window (t + 0.07) x y
 
-foreign import ccall safe "test_window"
-  testWindow :: IO ()
 
-main' :: IO ()
-main' = print newArray `catch` (\(e :: AFException) -> print e)
-  where
-    newArray = matrix @Double (2,2) [ [1..], [1..] ] * matrix @Double (2,2) [ [2..], [2..] ]
 
-main :: IO ()
-main = do
-  main'
-  -- testWindow
-  -- ks <- randn @Double [100,100]
-  -- saveArray "key" ks "array.txt" False
-  -- !ks' <- readArrayKey "array.txt" "key"
-  -- print ks'
 
---   info >> putStrLn "ok" >> afInit
---   -- Info things
---   print =<< getSizeOf (Proxy @ Double)
---   print =<< getVersion
---   print =<< getRevision
---   -- getInfo
---   -- print =<< errorToString afErrNoMem
---   putStrLn =<< getInfoString
---   print =<< getDeviceCount
---   print =<< getDevice
 
---   -- Create and print an array
---   -- arr1 <- constant 1 1 1 f64
---   -- arr2 <- constant 2 1 1 f64
---   -- r <- addArray arr1 arr2 True
---   -- printArray r
 
---   -- print =<< isLAPACKAvailable
---   -- print =<< getAvailableBackends
---   -- print =<< getActiveBackend
---   -- print =<< getAvailableBackends
 
---   -- array <- constant @'(10,10) 200
---   -- putStrLn "backend id"
---   -- print (getBackendID array)
---   -- putStrLn "device id"
---   -- print (getDeviceID array)
 
---   -- array <- randu @'(9,9,9) @Double
---   -- printArray array  -- printArray (mean array 0)
 
--- --  printArray (add array 1)
 
---   -- putStrLn "got eeem"
---   -- print =<< getDataPtr x
 
---   -- x <- constant 10 1 1 f64
---   -- printArray =<< mean x 0
 
--- --  print =<< isLAPACKAvailable
 
---   a <- randu @'(3,3) @Float
---   b <- randu @'(3,3) @Float
---   printArray ((a `matmul` b) None None)
---     `catch` (\(e :: AFException) -> do
---                 putStrLn "got one"
---                 print e)
 
-  putStrLn "create window"
-  window <- createWindow 200 200 "hey"
-  putStrLn "set visibility"
-  setVisibility window True
-  putStrLn "show window"
-  showWindow window
-  threadDelay (secs 10)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+foreign import ccall safe "test_bool"
+  testBool :: IO ()
+
+foreign import ccall safe "test_window"
+  testWindow :: IO ()
+
+-- main' :: IO ()
+-- main' = print newArray `catch` (\(e :: AFException) -> print e)
+--   where
+--     newArray = matrix @Double (2,2) [ [1..], [1..] ] * matrix @Double (2,2) [ [2..], [2..] ]
+
+main2 :: IO ()
+main2 = do
+  window <- createWindow 800 600 "hey"
+  go window
+    where
+      go window = do
+        let x = iota [1,60] [60,1] / (30 :: Array Float)
+            cell = Cell (-1) (-1) mempty ColorMapDefault
+        drawImage window x cell
+        closed <- isWindowClosed window
+        unless closed $ go window
+
 
 --   -- print =<< getActiveBackend
 --   -- print =<< getDeviceCount
diff --git a/src/ArrayFire.hs b/src/ArrayFire.hs
--- a/src/ArrayFire.hs
+++ b/src/ArrayFire.hs
@@ -97,14 +97,17 @@
 -- import qualified ArrayFire as A
 --
 -- main :: IO ()
--- main = print $ A.matrix @Double (2,2) [[1,2],[3,4]]
+-- main = print $ A.matrix @Double (3,2) [[1,2,3],[4,5,6]]
 -- @
 --
+-- Each 'Array' is constructed and displayed in column-major order.
+--
 -- @
 -- ArrayFire Array
--- [2 2 1 1]
---     1.0000     2.0000
---     3.0000     4.0000
+-- [3 2 1 1]
+--    1.0000     4.0000
+--    2.0000     5.0000
+--    3.0000     6.0000
 -- @
 
 -- $modules
@@ -128,7 +131,7 @@
 -- main = A.printArray action \`catch\` (\\(e :: A.AFException) -> print e)
 --   where
 --     action =
---       A.matrix \@Double (3,3) [[[1..],[1..],[1..]]]
+--       A.matrix \@Double (3,3) [[1..],[1..],[1..]]
 --         \`A.mul\` A.matrix \@Double (2,2) [[1..],[1..]]
 -- @
 --
@@ -140,6 +143,8 @@
 -- $construction
 -- An 'Array' can be constructed using the following smart constructors:
 --
+-- /Note/: All smart constructors (and ArrayFire internally) assume column-major order.
+--
 -- @
 -- >>> scalar \@Double 2.0
 -- ArrayFire Array
@@ -151,15 +156,24 @@
 -- >>> vector \@Double 10 [1..]
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.0000     2.0000     3.0000     4.0000     5.0000     6.0000     7.0000     8.0000     9.0000    10.0000
+--     1.0000
+--     2.0000
+--     3.0000
+--     4.0000
+--     5.0000
+--     6.0000
+--     7.0000
+--     8.0000
+--     9.0000
+--    10.0000
 -- @
 --
 -- @
 -- >>> matrix \@Double (2,2) [[1,2],[3,4]]
 -- ArrayFire Array
 -- [2 2 1 1]
---    1.0000     2.0000
---    3.0000     4.0000
+--     1.0000     3.0000
+--     2.0000     4.0000
 -- @
 --
 -- @
@@ -193,18 +207,27 @@
 --
 -- Array construction can use Haskell's lazy lists, since 'take' is called on each dimension before sending to the C API.
 --
--- >>> mkArray @Double [2,2] [ [1..], [1..] ]
+-- >>> mkArray @Double [5,3] [1..]
 -- ArrayFire Array
--- [10 1 1 1]
---     1.0000     2.0000     3.0000     4.0000     5.0000     6.0000     7.0000     8.0000     9.0000    10.0000
+-- [5 3 1 1]
+--    1.0000     6.0000    11.0000
+--    2.0000     7.0000    12.0000
+--    3.0000     8.0000    13.0000
+--    4.0000     9.0000    14.0000
+--    5.0000    10.0000    15.0000
 --
--- Specifying up to 4 dimensions is allowed (anything high is ignored).
+-- Specifying up to 4 dimensions is allowed (anything higher is ignored).
 
 -- $laws
--- Every 'Array' is an instance of 'Eq', 'Num', 'Fractional', 'Floating'
+-- Every 'Array' has an instance of 'Eq', 'Num', 'Fractional', 'Floating' and 'Show'
 --
 -- 'Num'
 --
+-- >>> 2.0 :: Array Double
+-- ArrayFire Array
+-- [1 1 1 1]
+--    2.0000
+--
 -- >>> scalar @Int 1 + scalar @Int 1
 -- ArrayFire Array
 -- [1 1 1 1]
@@ -240,7 +263,6 @@
 -- >>> scalar @Double 1 [10] /= scalar @Double 1 [10]
 -- False
 --
---
 -- 'Floating'
 --
 -- >>> pi :: Array Double
@@ -248,9 +270,33 @@
 -- [1 1 1 1]
 --    3.1416
 --
+-- >>> A.sqrt pi :: Array Double
+-- ArrayFire Array
+-- [1 1 1 1]
+--    1.7725
+--
+-- 'Fractional'
+--
+-- >>> (pi :: Array Double) / pi
+-- ArrayFire Array
+-- [1 1 1 1]
+--    1.000
+--
+-- >>> recip 0.5 :: Array Double
+-- ArrayFire Array
+-- [1 1 1 1]
+--    2.000
+--
+-- 'Show'
+--
+-- >>> 0.0 :: Array Double
+-- ArrayFire Array
+-- [1 1 1 1]
+--    0.000
+--
 
 -- $conversion
--- 'Array' can be exported into Haskell using `toVector'. This will create a Storable vector suitable for use in other C programs.
+-- Any 'Array' can be exported into Haskell using `toVector'. This will create a Storable vector suitable for use in other C programs.
 --
 -- >>> vector :: Vector Double <- toVector <$> randu @Double [10,10]
 --
@@ -271,9 +317,9 @@
 --     array <- A.'readArrayKey' "file.array" "key"
 --     'print' array
 --
--- ArrayFire Array
--- [ 1 1 1 1 ]
---         10
+-- -- ArrayFire Array
+-- -- [ 1 1 1 1 ]
+-- --         10
 -- @
 --
 
@@ -287,6 +333,6 @@
 --
 
 -- $visualization
--- The ArrayFire API is able to visualize
+-- The ArrayFire API is able to display visualizations using the Forge library
 -- >>> window <- createWindow 800 600 "Histogram"
 --
diff --git a/src/ArrayFire/Algorithm.hs b/src/ArrayFire/Algorithm.hs
--- a/src/ArrayFire/Algorithm.hs
+++ b/src/ArrayFire/Algorithm.hs
@@ -19,7 +19,9 @@
 --
 -- main :: IO ()
 -- main = print $ A.sum (A.vector @Double 10 [1..]) 0
--- -- 55
+-- -- ArrayFire Array
+-- -- [1 1 1 1]
+-- --   55.0000
 -- @
 --------------------------------------------------------------------------------
 module ArrayFire.Algorithm where
@@ -31,10 +33,24 @@
 -- | Sum all of the elements in 'Array' along the specified dimension
 --
 -- >>> A.sum (A.vector @Double 10 [1..]) 0
--- 55.0
+-- ArrayFire Array
+-- [1 1 1 1]
+--    55.0000
 --
--- >>> A.matrix @Double (10,10) $ replicate 10 [1..]
--- 65.0
+-- >>> A.sum (A.matrix @Double (10,10) $ replicate 10 [1..]) 1
+-- ArrayFire Array
+-- [10 1 1 1]
+--    10.0000
+--    20.0000
+--    30.0000
+--    40.0000
+--    50.0000
+--    60.0000
+--    70.0000
+--    80.0000
+--    90.0000
+--   100.0000
+--
 sum
   :: AFType a
   => Array a
@@ -48,7 +64,9 @@
 -- | Sum all of the elements in 'Array' along the specified dimension, using a default value for NaN
 --
 -- >>> A.sumNaN (A.vector @Double 10 [1..]) 0 0.0
--- 55
+-- ArrayFire Array
+-- [1 1 1 1]
+--   55.0000
 sumNaN
   :: (Fractional a, AFType a)
   => Array a
@@ -64,7 +82,9 @@
 -- | Product all of the elements in 'Array' along the specified dimension
 --
 -- >>> A.product (A.vector @Double 10 [1..]) 0
--- 3628800.0
+-- ArrayFire Array
+-- [1 1 1 1]
+-- 3628800.0000
 product
   :: AFType a
   => Array a
@@ -78,7 +98,9 @@
 -- | Product all of the elements in 'Array' along the specified dimension, using a default value for NaN
 --
 -- >>> A.productNaN (A.vector @Double 10 [1..]) 0 0.0
--- 3628800.0
+-- ArrayFire Array
+-- [1 1 1 1]
+-- 3628800.0000
 productNaN
   :: (AFType a, Fractional a)
   => Array a
@@ -94,7 +116,9 @@
 -- | Take the minimum of an 'Array' along a specific dimension
 --
 -- >>> A.min (A.vector @Double 10 [1..]) 0
--- 1.0
+-- ArrayFire Array
+-- [1 1 1 1]
+--    1.0000
 min
   :: AFType a
   => Array a
@@ -108,7 +132,9 @@
 -- | Take the maximum of an 'Array' along a specific dimension
 --
 -- >>> A.max (A.vector @Double 10 [1..]) 0
--- 10
+-- ArrayFire Array
+-- [1 1 1 1]
+--   10.0000
 max
   :: AFType a
   => Array a
@@ -122,7 +148,9 @@
 -- | Find if all elements in an 'Array' are 'True' along a dimension
 --
 -- >>> A.allTrue (A.vector @CBool 10 (repeat 0)) 0
--- False
+-- ArrayFire Array
+-- [1 1 1 1]
+--         0
 allTrue
   :: forall a. AFType a
   => Array a
@@ -137,7 +165,9 @@
 -- | Find if any elements in an 'Array' are 'True' along a dimension
 --
 -- >>> A.anyTrue (A.vector @CBool 10 (repeat 0)) 0
--- False
+-- ArrayFire Array
+-- [1 1 1 1]
+--         0
 anyTrue
   :: forall a . AFType a
   => Array a
@@ -152,7 +182,9 @@
 -- | Count elements in an 'Array' along a dimension
 --
 -- >>> A.count (A.vector @Double 10 [1..]) 0
--- 10
+-- ArrayFire Array
+-- [1 1 1 1]
+--        10
 count
   :: forall a . AFType a
   => Array a
@@ -348,7 +380,16 @@
 -- >>> A.accum (A.vector @Double 10 [1..]) 0
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.0000     3.0000     6.0000    10.0000    15.0000    21.0000    28.0000    36.0000    45.0000    55.0000
+--     1.0000
+--     3.0000
+--     6.0000
+--    10.0000
+--    15.0000
+--    21.0000
+--    28.0000
+--    36.0000
+--    45.0000
+--    55.0000
 accum
   :: AFType a
   => Array a
@@ -364,7 +405,16 @@
 -- >>> A.scan (A.vector @Double 10 [1..]) 0 Add True
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.0000     3.0000     6.0000    10.0000    15.0000    21.0000    28.0000    36.0000    45.0000    55.0000
+--     1.0000
+--     3.0000
+--     6.0000
+--    10.0000
+--    15.0000
+--    21.0000
+--    28.0000
+--    36.0000
+--    45.0000
+--    55.0000
 scan
   :: AFType a
   => Array a
@@ -384,8 +434,17 @@
 --
 -- >>> A.scanByKey (A.vector @Int 7 [2..]) (A.vector @Int 10 [1..]) 1 Add True
 -- ArrayFire Array
--- [7 1 1 1]
---         2          3          4          5          6          7          8
+-- [10 1 1 1]
+--          1
+--          2
+--          3
+--          4
+--          5
+--          6
+--          7
+--          8
+--          9
+--         10
 scanByKey
   :: (AFType a, AFType k)
   => Array k
@@ -421,7 +480,9 @@
 -- >>> A.diff1 (A.vector @Double 4 [10,35,65,95]) 0
 -- ArrayFire Array
 -- [3 1 1 1]
---   25.0000    30.0000    30.0000
+--    25.0000
+--    30.0000
+--    30.0000
 diff1
   :: AFType a
   => Array a
@@ -437,7 +498,9 @@
 -- >>> A.diff2 (A.vector @Double 5 [1.0,20,55,89,44]) 0
 -- ArrayFire Array
 -- [3 1 1 1]
---   16.0000    -1.0000   -79.0000
+--    16.0000
+--    -1.0000
+--   -79.0000
 diff2
   :: AFType a
   => Array a
@@ -453,12 +516,18 @@
 -- >>> A.sort (A.vector @Double 4 [ 2,4,3,1 ]) 0 True
 -- ArrayFire Array
 -- [4 1 1 1]
---    1.0000     2.0000     3.0000     4.0000
+--     1.0000
+--     2.0000
+--     3.0000
+--     4.0000
 --
 -- >>> A.sort (A.vector @Double 4 [ 2,4,3,1 ]) 0 False
 -- ArrayFire Array
 -- [4 1 1 1]
---    4.0000     3.0000     2.0000     1.0000
+--     4.0000
+--     3.0000
+--     2.0000
+--     1.0000
 sort
   :: AFType a
   => Array a
@@ -474,14 +543,19 @@
 
 -- | Sort an 'Array' along a specified dimension, specifying ordering of results (ascending / descending), returns indices of sorted results
 --
---
 -- >>> A.sortIndex (A.vector @Double 4 [3,2,1,4]) 0 True
 -- (ArrayFire Array
 -- [4 1 1 1]
---     1.0000     2.0000     3.0000     4.0000
+--     1.0000
+--     2.0000
+--     3.0000
+--     4.0000
 -- ,ArrayFire Array
 -- [4 1 1 1]
---          2          1          0          3
+--          2
+--          1
+--          0
+--          3
 -- )
 sortIndex
   :: AFType a
@@ -501,10 +575,16 @@
 -- >>> A.sortByKey (A.vector @Double 4 [2,1,4,3]) (A.vector @Double 4 [10,9,8,7]) 0 True
 -- (ArrayFire Array
 -- [4 1 1 1]
---     1.0000     2.0000     3.0000     4.0000
+--     1.0000
+--     2.0000
+--     3.0000
+--     4.0000
 -- ,ArrayFire Array
 -- [4 1 1 1]
---     9.0000    10.0000     7.0000     8.0000
+--     9.0000
+--    10.0000
+--     7.0000
+--     8.0000
 -- )
 sortByKey
   :: AFType a
@@ -542,7 +622,11 @@
 -- >>> A.setUnion (A.vector @Double 3 [3,4,5]) (A.vector @Double 3 [1,2,3]) True
 -- ArrayFire Array
 -- [5 1 1 1]
---    1.0000     2.0000     3.0000     4.0000     5.0000
+--     1.0000
+--     2.0000
+--     3.0000
+--     4.0000
+--     5.0000
 setUnion
   :: AFType a
   => Array a
@@ -560,7 +644,7 @@
 -- >>> A.setIntersect (A.vector @Double 3 [3,4,5]) (A.vector @Double 3 [1,2,3]) True
 -- ArrayFire Array
 -- [1 1 1 1]
---    3.0000
+--     3.0000
 setIntersect
   :: AFType a
   => Array a
diff --git a/src/ArrayFire/Arith.hs b/src/ArrayFire/Arith.hs
--- a/src/ArrayFire/Arith.hs
+++ b/src/ArrayFire/Arith.hs
@@ -20,7 +20,10 @@
 --
 -- main :: IO ()
 -- main = print $ A.scalar \@Int 1 \`A.add\` A.scalar \@Int 1
--- -- 2
+--
+-- -- ArrayFire Array
+-- -- [1 1 1 1]
+-- --        2
 -- @
 --------------------------------------------------------------------------------
 module ArrayFire.Arith where
@@ -133,7 +136,6 @@
 
 -- | Multiply two 'Array' objects
 --
---
 -- >>> (A.scalar @Int 2 `mulBatched` A.scalar @Int 2) True
 -- ArrayFire Array
 -- [1 1 1 1]
@@ -196,8 +198,6 @@
 -- ArrayFire Array
 -- [1 1 1 1]
 --         0
--- >>> A.scalar @Int 1 < A.scalar @Int 1
--- False
 lt
   :: AFType a
   => Array a
@@ -216,8 +216,6 @@
 -- ArrayFire Array
 -- [1 1 1 1]
 --         0
--- >>> A.scalar @Int 1 < A.scalar @Int 1
--- False
 ltBatched
   :: AFType a
   => Array a
@@ -238,8 +236,6 @@
 -- ArrayFire Array
 -- [1 1 1 1]
 --         0
--- >>> A.scalar @Int 1 > A.scalar @Int 2
--- False
 gt
   :: AFType a
   => Array a
@@ -255,7 +251,9 @@
 -- | Test if an 'Array' is greater than another 'Array'
 --
 -- >>> (A.scalar @Int 1 `gtBatched` A.scalar @Int 1) True
--- False
+-- ArrayFire Array
+-- [1 1 1 1]
+--          0
 gtBatched
   :: AFType a
   => Array a
@@ -276,8 +274,6 @@
 -- ArrayFire Array
 -- [1 1 1 1]
 --         1
--- >>> A.scalar @Int 1 <= A.scalar @Int 1
--- False
 le
   :: AFType a
   => Array a
@@ -296,8 +292,6 @@
 -- ArrayFire Array
 -- [1 1 1 1]
 --         1
--- >>> A.scalar @Int 1 <= A.scalar @Int 1
--- True
 leBatched
   :: AFType a
   => Array a
@@ -318,8 +312,6 @@
 -- ArrayFire Array
 -- [1 1 1 1]
 --         1
--- >>> A.scalar @Int 1 >= A.scalar @Int 1
--- True
 ge
   :: AFType a
   => Array a
@@ -334,8 +326,10 @@
 
 -- | Test if one 'Array' is greater than or equal to another 'Array'
 --
---
 -- >>> (A.scalar @Int 1 `A.geBatched` A.scalar @Int 1) True
+-- ArrayFire Array
+-- [1 1 1 1]
+--          1
 --
 geBatched
   :: AFType a
@@ -357,9 +351,6 @@
 -- ArrayFire Array
 -- [1 1 1 1]
 --         1
---
--- >>> A.scalar @Int 1 == A.scalar @Int 1
--- True
 eq
   :: AFType a
   => Array a
@@ -375,6 +366,9 @@
 -- | Test if one 'Array' is equal to another 'Array'
 --
 -- >>> (A.scalar @Int 1 `A.eqBatched` A.scalar @Int 1) True
+-- ArrayFire Array
+-- [1 1 1 1]
+--          1
 --
 eqBatched
   :: AFType a
@@ -394,10 +388,8 @@
 --
 -- >>> A.scalar @Int 1 `A.neq` A.scalar @Int 1
 -- ArrayFire Array
---[1 1 1 1]
+-- [1 1 1 1]
 --         0
--- >>> A.scalar @Int 1 /= A.scalar @Int 1
--- False
 neq
   :: AFType a
   => Array a
@@ -413,7 +405,9 @@
 -- | Test if one 'Array' is not equal to another 'Array'
 --
 -- >>> (A.scalar @Int 1 `A.neqBatched` A.scalar @Int 1) True
--- False
+-- ArrayFire Array
+-- [1 1 1 1]
+--          0
 neqBatched
   :: AFType a
   => Array a
@@ -488,7 +482,6 @@
 
 -- | Logical 'or' one 'Array' with another
 --
---
 -- >>> (A.scalar @Int 1 `A.orBatched` A.scalar @Int 1) True
 -- ArrayFire Array
 -- [1 1 1 1]
@@ -713,7 +706,6 @@
 
 -- | Cast one 'Array' into another
 --
---
 -- >>> A.cast (A.scalar @Int 1) :: Array Double
 -- ArrayFire Array
 -- [1 1 1 1]
@@ -790,7 +782,7 @@
 --
 -- >>> A.maxOfBatched (A.scalar @Int 1) (A.scalar @Int 0) False
 -- ArrayFire Array
---[1 1 1 1]
+-- [1 1 1 1]
 --         1
 maxOfBatched
   :: AFType a
@@ -808,7 +800,6 @@
 
 -- | Should take the clamp
 --
---
 -- >>> clamp (A.scalar @Int 2) (A.scalar @Int 1) (A.scalar @Int 3)
 -- ArrayFire Array
 -- [1 1 1 1]
@@ -853,7 +844,16 @@
 -- >>> A.rem (A.vector @Int 10 [1..]) (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---         0          0          0          0          0          0          0          0          0          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
 rem
   :: AFType a
   => Array a
@@ -868,9 +868,19 @@
 
 -- | Find the remainder of two 'Array's
 --
---
--- >>> A.remBatched (A.vector @Int 10 [1..])  (vector @Int 10 [1..]) True
---
+-- >>> A.remBatched (A.vector @Int 10 [1..])  (vector @Int 10 [2..]) True
+-- ArrayFire Array
+-- [10 1 1 1]
+--          1
+--          2
+--          3
+--          4
+--          5
+--          6
+--          7
+--          8
+--          9
+--         10
 remBatched
   :: AFType a
   => Array a
@@ -889,8 +899,17 @@
 --
 -- >>> A.mod (A.vector @Int 10 [1..]) (A.vector @Int 10 [1..])
 -- ArrayFire Array
---[10 1 1 1]
---         0          0          0          0          0          0          0          0          0          0
+-- [10 1 1 1]
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
 mod
   :: AFType a
   => Array a
@@ -908,7 +927,16 @@
 -- >>> A.modBatched (vector @Int 10 [1..]) (vector @Int 10 [1..]) True
 -- ArrayFire Array
 -- [10 1 1 1]
---         0          0          0          0          0          0          0          0          0          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
 modBatched
   :: AFType a
   => Array a
@@ -943,7 +971,16 @@
 -- >>> A.arg (vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---         0          0          0          0          0          0          0          0          0          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
 arg
   :: AFType a
   => Array a
@@ -957,7 +994,16 @@
 -- >>> A.sign (vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---   0.0000     0.0000     0.0000     0.0000     0.0000     0.0000     0.0000     0.0000     0.0000     0.0000
+--     0.0000
+--     0.0000
+--     0.0000
+--     0.0000
+--     0.0000
+--     0.0000
+--     0.0000
+--     0.0000
+--     0.0000
+--     0.0000
 sign
   :: AFType a
   => Array a
@@ -968,10 +1014,19 @@
 
 -- | Round the values in an 'Array'
 --
--- >>> A.round (A.vector @Int 10 [1..])
+-- >>> A.round (A.vector @Double 10 [1.4,1.5..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.0000     2.0000     3.0000     4.0000     5.0000     6.0000     7.0000     8.0000     9.0000    10.0000
+--     1.0000
+--     2.0000
+--     2.0000
+--     2.0000
+--     2.0000
+--     2.0000
+--     2.0000
+--     2.0000
+--     2.0000
+--     2.0000
 round
   :: AFType a
   => Array a
@@ -982,10 +1037,19 @@
 
 -- | Truncate the values of an 'Array'
 --
--- >>> A.trunc (A.vector @Int 10 [1..])
+-- >>> A.trunc (A.vector @Double 10 [0.9,1.0..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.0000     2.0000     3.0000     4.0000     5.0000     6.0000     7.0000     8.0000     9.0000    10.0000
+--     0.0000
+--     1.0000
+--     1.0000
+--     1.0000
+--     1.0000
+--     1.0000
+--     1.0000
+--     1.0000
+--     1.0000
+--     1.0000
 trunc
   :: AFType a
   => Array a
@@ -996,10 +1060,19 @@
 
 -- | Take the floor of all values in an 'Array'
 --
--- >>> A.floor (A.vector @Int 10 [10,9..])
+-- >>> A.floor (A.vector @Double 10 [11.0,10.9..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.0000     2.0000     3.0000     4.0000     5.0000     6.0000     7.0000     8.0000     9.0000    10.0000
+--    11.0000
+--    10.0000
+--    10.0000
+--    10.0000
+--    10.0000
+--    10.0000
+--    10.0000
+--    10.0000
+--    10.0000
+--    10.0000
 floor
   :: AFType a
   => Array a
@@ -1010,10 +1083,19 @@
 
 -- | Take the ceil of all values in an 'Array'
 --
--- >>> A.ceil (A.vector @Int 10 [1..])
+-- >>> A.ceil (A.vector @Double 10 [0.9,1.0..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.0000     2.0000     3.0000     4.0000     5.0000     6.0000     7.0000     8.0000     9.0000    10.0000
+--     1.0000
+--     1.0000
+--     2.0000
+--     2.0000
+--     2.0000
+--     2.0000
+--     2.0000
+--     2.0000
+--     2.0000
+--     2.0000
 ceil
   :: AFType a
   => Array a
@@ -1027,7 +1109,16 @@
 -- >>> A.sin (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.8415     0.9093     0.1411    -0.7568    -0.9589    -0.2794     0.6570     0.9894     0.4121    -0.5440
+--     0.8415
+--     0.9093
+--     0.1411
+--    -0.7568
+--    -0.9589
+--    -0.2794
+--     0.6570
+--     0.9894
+--     0.4121
+--    -0.5440
 sin
   :: AFType a
   => Array a
@@ -1041,7 +1132,16 @@
 -- >>> A.cos (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.5403    -0.4161    -0.9900    -0.6536     0.2837     0.9602     0.7539    -0.1455    -0.9111    -0.8391
+--     0.5403
+--    -0.4161
+--    -0.9900
+--    -0.6536
+--     0.2837
+--     0.9602
+--     0.7539
+--    -0.1455
+--    -0.9111
+--    -0.8391
 cos
   :: AFType a
   => Array a
@@ -1055,7 +1155,16 @@
 -- >>> A.tan (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.5574    -2.1850    -0.1425     1.1578    -3.3805    -0.2910     0.8714    -6.7997    -0.4523     0.6484
+--     1.5574
+--    -2.1850
+--    -0.1425
+--     1.1578
+--    -3.3805
+--    -0.2910
+--     0.8714
+--    -6.7997
+--    -0.4523
+--     0.6484
 tan
   :: AFType a
   => Array a
@@ -1069,7 +1178,16 @@
 -- >>> A.asin (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.5708        nan        nan        nan        nan        nan        nan        nan        nan        nan
+--     1.5708
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
 --
 asin
   :: AFType a
@@ -1084,7 +1202,16 @@
 -- >>> A.acos (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.0000        nan        nan        nan        nan        nan        nan        nan        nan        nan
+--     0.0000
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
 acos
   :: AFType a
   => Array a
@@ -1098,7 +1225,16 @@
 -- >>> A.atan (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.7854     1.1071     1.2490     1.3258     1.3734     1.4056     1.4289     1.4464     1.4601     1.4711
+--     0.7854
+--     1.1071
+--     1.2490
+--     1.3258
+--     1.3734
+--     1.4056
+--     1.4289
+--     1.4464
+--     1.4601
+--     1.4711
 atan
   :: AFType a
   => Array a
@@ -1109,10 +1245,19 @@
 
 -- | Take the atan2 of all values in an 'Array'
 --
--- >>> A.atan2 (A.vector @Int 10 [1..]) (A.vector @Int 10 [1..])
+-- >>> A.atan2 (A.vector @Double 10 [1..]) (A.vector @Double 10 [2..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.7854     0.7854     0.7854     0.7854     0.7854     0.7854     0.7854     0.7854     0.7854     0.7854
+--     0.4636
+--     0.5880
+--     0.6435
+--     0.6747
+--     0.6947
+--     0.7086
+--     0.7188
+--     0.7266
+--     0.7328
+--     0.7378
 atan2
   :: AFType a
   => Array a
@@ -1127,10 +1272,19 @@
 
 -- | Take the atan2 of all values in an 'Array'
 --
--- >>> A.atan2Batched (A.vector @Int 10 [1..]) (A.vector @Int 10 [1..]) True
+-- >>> A.atan2Batched (A.vector @Double 10 [1..]) (A.vector @Double 10 [2..]) True
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.7854     0.7854     0.7854     0.7854     0.7854     0.7854     0.7854     0.7854     0.7854     0.7854
+--     0.4636
+--     0.5880
+--     0.6435
+--     0.6747
+--     0.6947
+--     0.7086
+--     0.7188
+--     0.7266
+--     0.7328
+--     0.7378
 atan2Batched
   :: AFType a
   => Array a
@@ -1150,7 +1304,16 @@
 -- >>> A.cplx2 (A.vector @Int 10 [1..]) (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---         (1.0000,1.0000)          (2.0000,2.0000)          (3.0000,3.0000)          (4.0000,4.0000)          (5.0000,5.0000)          (6.0000,6.0000)          (7.0000,7.0000)          (8.0000,8.0000)          (9.0000,9.0000)          (10.0000,10.0000)
+--          (1.0000,1.0000)
+--          (2.0000,2.0000)
+--          (3.0000,3.0000)
+--          (4.0000,4.0000)
+--          (5.0000,5.0000)
+--          (6.0000,6.0000)
+--          (7.0000,7.0000)
+--          (8.0000,8.0000)
+--          (9.0000,9.0000)
+--          (10.0000,10.0000)
 cplx2
   :: AFType a
   => Array a
@@ -1165,10 +1328,19 @@
 
 -- | Take the cplx2Batched of all values in an 'Array'
 --
--- >>> A.cplx2Batched (A..vector @Int 10 [1..]) (A.vector @Int 10 [1..]) True
+-- >>> A.cplx2Batched (A.vector @Int 10 [1..]) (A.vector @Int 10 [1..]) True
 -- ArrayFire Array
 -- [10 1 1 1]
---         (1.0000,1.0000)          (2.0000,2.0000)          (3.0000,3.0000)          (4.0000,4.0000)          (5.0000,5.0000)          (6.0000,6.0000)          (7.0000,7.0000)          (8.0000,8.0000)          (9.0000,9.0000)          (10.0000,10.0000)
+--          (1.0000,1.0000)
+--          (2.0000,2.0000)
+--          (3.0000,3.0000)
+--          (4.0000,4.0000)
+--          (5.0000,5.0000)
+--          (6.0000,6.0000)
+--          (7.0000,7.0000)
+--          (8.0000,8.0000)
+--          (9.0000,9.0000)
+--          (10.0000,10.0000)
 cplx2Batched
   :: AFType a
   => Array a
@@ -1188,7 +1360,16 @@
 -- >>> A.cplx (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---         (1.0000,0.0000)          (2.0000,0.0000)          (3.0000,0.0000)          (4.0000,0.0000)          (5.0000,0.0000)          (6.0000,0.0000)          (7.0000,0.0000)          (8.0000,0.0000)          (9.0000,0.0000)          (10.0000,0.0000)
+--          (1.0000,0.0000)
+--          (2.0000,0.0000)
+--          (3.0000,0.0000)
+--          (4.0000,0.0000)
+--          (5.0000,0.0000)
+--          (6.0000,0.0000)
+--          (7.0000,0.0000)
+--          (8.0000,0.0000)
+--          (9.0000,0.0000)
+--          (10.0000,0.0000)
 cplx
   :: AFType a
   => Array a
@@ -1201,7 +1382,7 @@
 --
 -- >>> A.real (A.scalar @(Complex Double) (10 :+ 11)) :: Array Double
 -- ArrayFire Array
--- [10 1 1 1]
+-- [1 1 1 1]
 --    10.0000
 real
   :: (AFType a, AFType (Complex b), RealFrac a, RealFrac b)
@@ -1215,7 +1396,7 @@
 --
 -- >>> A.imag (A.scalar @(Complex Double) (10 :+ 11)) :: Array Double
 -- ArrayFire Array
--- [10 1 1 1]
+-- [1 1 1 1]
 --    11.0000
 imag
   :: (AFType a, AFType (Complex b), RealFrac a, RealFrac b)
@@ -1230,7 +1411,16 @@
 -- >>> A.conjg (A.vector @Double 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.0000     2.0000     3.0000     4.0000     5.0000     6.0000     7.0000     8.0000     9.0000    10.0000
+--     1.0000
+--     2.0000
+--     3.0000
+--     4.0000
+--     5.0000
+--     6.0000
+--     7.0000
+--     8.0000
+--     9.0000
+--    10.0000
 conjg
   :: AFType a
   => Array a
@@ -1244,7 +1434,16 @@
 -- >>> A.sinh (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.1752     3.6269    10.0179    27.2899    74.2032   201.7132   548.3161  1490.4788  4051.5419 11013.2329
+--     1.1752
+--     3.6269
+--    10.0179
+--    27.2899
+--    74.2032
+--   201.7132
+--   548.3161
+--  1490.4789
+--  4051.5420
+-- 11013.2324
 sinh
   :: AFType a
   => Array a
@@ -1255,11 +1454,19 @@
 
 -- | Execute cosh
 --
---
 -- >>> A.cosh (A.vector @Double 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.5431     3.7622    10.0677    27.3082    74.2099   201.7156   548.3170  1490.4792  4051.5420 11013.2329
+--     1.5431
+--     3.7622
+--    10.0677
+--    27.3082
+--    74.2099
+--   201.7156
+--   548.3170
+--  1490.4792
+--  4051.5420
+-- 11013.2329
 cosh
   :: AFType a
   => Array a
@@ -1273,7 +1480,16 @@
 -- >>> A.tanh (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.7616     0.9640     0.9951     0.9993     0.9999     1.0000     1.0000     1.0000     1.0000     1.0000
+--     0.7616
+--     0.9640
+--     0.9951
+--     0.9993
+--     0.9999
+--     1.0000
+--     1.0000
+--     1.0000
+--     1.0000
+--     1.0000
 tanh
   :: AFType a
   => Array a
@@ -1287,7 +1503,16 @@
 -- >>> A.asinh (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.8814     1.4436     1.8184     2.0947     2.3124     2.4918     2.6441     2.7765     2.8934     2.9982 
+--     0.8814
+--     1.4436
+--     1.8184
+--     2.0947
+--     2.3124
+--     2.4918
+--     2.6441
+--     2.7765
+--     2.8934
+--     2.9982
 asinh
   :: AFType a
   => Array a
@@ -1301,7 +1526,16 @@
 -- >>> A.acosh (A.vector @Double 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.0000     1.3170     1.7627     2.0634     2.2924     2.4779     2.6339     2.7687     2.8873     2.9932 
+--     0.0000
+--     1.3170
+--     1.7627
+--     2.0634
+--     2.2924
+--     2.4779
+--     2.6339
+--     2.7687
+--     2.8873
+--     2.9932
 acosh
   :: AFType a
   => Array a
@@ -1315,7 +1549,16 @@
 -- >>> A.atanh (A.vector @Double 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---        inf        nan        nan        nan        nan        nan        nan        nan        nan        nan 
+--        inf
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
 atanh
   :: AFType a
   => Array a
@@ -1329,7 +1572,16 @@
 -- >>> A.root (A.vector @Double 10 [1..]) (A.vector @Double 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.0000     1.4142     1.4422     1.4142     1.3797     1.3480     1.3205     1.2968     1.2765     1.2589
+--     1.0000
+--     1.4142
+--     1.4422
+--     1.4142
+--     1.3797
+--     1.3480
+--     1.3205
+--     1.2968
+--     1.2765
+--     1.2589
 root
   :: AFType a
   => Array a
@@ -1347,7 +1599,16 @@
 -- >>> A.rootBatched (vector @Double 10 [1..]) (vector @Double 10 [1..]) True
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.0000     1.4142     1.4422     1.4142     1.3797     1.3480     1.3205     1.2968     1.2765     1.2589
+--     1.0000
+--     1.4142
+--     1.4422
+--     1.4142
+--     1.3797
+--     1.3480
+--     1.3205
+--     1.2968
+--     1.2765
+--     1.2589
 rootBatched
   :: AFType a
   => Array a
@@ -1367,7 +1628,16 @@
 -- >>> A.pow (A.vector @Int 10 [1..]) 2
 -- ArrayFire Array
 -- [10 1 1 1]
---         1          4          9         16         25         36         49         64         81        100
+--          1
+--          4
+--          9
+--         16
+--         25
+--         36
+--         49
+--         64
+--         81
+--        100
 pow
   :: AFType a
   => Array a
@@ -1380,13 +1650,21 @@
   x `op2` y $ \arr arr1 arr2 ->
     af_pow arr arr1 arr2 1
 
-
 -- | Execute powBatched
 --
 -- >>> A.powBatched (A.vector @Int 10 [1..]) (A.constant @Int [1] 2) True
 -- ArrayFire Array
 -- [10 1 1 1]
---         1          4          9         16         25         36         49         64         81        100
+--          1
+--          4
+--          9
+--         16
+--         25
+--         36
+--         49
+--         64
+--         81
+--        100
 powBatched
   :: AFType a
   => Array a
@@ -1406,7 +1684,16 @@
 -- >>> A.pow2 (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---         2          4          8         16         32         64        128        256        512       1024
+--          2
+--          4
+--          8
+--         16
+--         32
+--         64
+--        128
+--        256
+--        512
+--       1024
 pow2
   :: AFType a
   => Array a
@@ -1420,7 +1707,16 @@
 -- >>> A.exp (A.vector @Double 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    2.7183     7.3891    20.0855    54.5982   148.4132   403.4288  1096.6332  2980.9580  8103.0839 22026.4658 
+--     2.7183
+--     7.3891
+--    20.0855
+--    54.5982
+--   148.4132
+--   403.4288
+--  1096.6332
+--  2980.9580
+--  8103.0839
+-- 22026.4658
 exp
   :: AFType a
   => Array a
@@ -1434,7 +1730,16 @@
 -- >>> A.sigmoid (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.7311     0.8808     0.9526     0.9820     0.9933     0.9975     0.9991     0.9997     0.9999     1.0000
+--     0.7311
+--     0.8808
+--     0.9526
+--     0.9820
+--     0.9933
+--     0.9975
+--     0.9991
+--     0.9997
+--     0.9999
+--     1.0000
 sigmoid
   :: AFType a
   => Array a
@@ -1448,7 +1753,16 @@
 -- >>> A.expm1 (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.7183     6.3891    19.0855    53.5981   147.4132   402.4288  1095.6332  2979.9580  8102.0840 22025.4648
+--     1.7183
+--     6.3891
+--    19.0855
+--    53.5981
+--   147.4132
+--   402.4288
+--  1095.6332
+--  2979.9580
+--  8102.0840
+-- 22025.4648
 expm1
   :: AFType a
   => Array a
@@ -1462,7 +1776,16 @@
 -- >>> A.erf (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.8427     0.9953     1.0000     1.0000     1.0000     1.0000     1.0000     1.0000     1.0000     1.0000
+--     0.8427
+--     0.9953
+--     1.0000
+--     1.0000
+--     1.0000
+--     1.0000
+--     1.0000
+--     1.0000
+--     1.0000
+--     1.0000
 erf
   :: AFType a
   => Array a
@@ -1476,7 +1799,16 @@
 -- >>> A.erfc (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.1573     0.0047     0.0000     0.0000     0.0000     0.0000     0.0000     0.0000     0.0000     0.0000
+--     0.1573
+--     0.0047
+--     0.0000
+--     0.0000
+--     0.0000
+--     0.0000
+--     0.0000
+--     0.0000
+--     0.0000
+--     0.0000
 erfc
   :: AFType a
   => Array a
@@ -1490,7 +1822,16 @@
 -- >>> A.log (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.0000     0.6931     1.0986     1.3863     1.6094     1.7918     1.9459     2.0794     2.1972     2.3026
+--     0.0000
+--     0.6931
+--     1.0986
+--     1.3863
+--     1.6094
+--     1.7918
+--     1.9459
+--     2.0794
+--     2.1972
+--     2.3026
 log
   :: AFType a
   => Array a
@@ -1504,7 +1845,16 @@
 -- >>> A.log1p (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.6931     1.0986     1.3863     1.6094     1.7918     1.9459     2.0794     2.1972     2.3026     2.3979
+--     0.6931
+--     1.0986
+--     1.3863
+--     1.6094
+--     1.7918
+--     1.9459
+--     2.0794
+--     2.1972
+--     2.3026
+--     2.3979
 log1p
   :: AFType a
   => Array a
@@ -1518,7 +1868,16 @@
 -- >>> A.log10 (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.0000     0.3010     0.4771     0.6021     0.6990     0.7782     0.8451     0.9031     0.9542     1.0000
+--     0.0000
+--     0.3010
+--     0.4771
+--     0.6021
+--     0.6990
+--     0.7782
+--     0.8451
+--     0.9031
+--     0.9542
+--     1.0000
 log10
   :: AFType a
   => Array a
@@ -1532,7 +1891,16 @@
 -- >>> A.log2 (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.0000     1.0000     1.5850     2.0000     2.3219     2.5850     2.8074     3.0000     3.1699     3.3219
+--     0.0000
+--     1.0000
+--     1.5850
+--     2.0000
+--     2.3219
+--     2.5850
+--     2.8074
+--     3.0000
+--     3.1699
+--     3.3219
 log2
   :: AFType a
   => Array a
@@ -1546,7 +1914,16 @@
 -- >>> A.sqrt (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.0000     1.4142     1.7321     2.0000     2.2361     2.4495     2.6458     2.8284     3.0000     3.1623
+--     1.0000
+--     1.4142
+--     1.7321
+--     2.0000
+--     2.2361
+--     2.4495
+--     2.6458
+--     2.8284
+--     3.0000
+--     3.1623
 sqrt
   :: AFType a
   => Array a
@@ -1560,7 +1937,16 @@
 -- >>> A.cbrt (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.0000     1.2599     1.4422     1.5874     1.7100     1.8171     1.9129     2.0000     2.0801     2.1544
+--     1.0000
+--     1.2599
+--     1.4422
+--     1.5874
+--     1.7100
+--     1.8171
+--     1.9129
+--     2.0000
+--     2.0801
+--     2.1544
 cbrt
   :: AFType a
   => Array a
@@ -1569,10 +1955,21 @@
   -- ^ Result of calling 'cbrt'
 cbrt = flip op1 af_cbrt
 
--- | Execute factorial1
---
--- >>> A.factorial1 (A.vector @Int 10 [1..])
+-- | Execute factorial
 --
+-- >>> A.factorial (A.vector @Int 10 [1..])
+-- ArrayFire Array
+-- [10 1 1 1]
+--     1.0000
+--     2.0000
+--     6.0000
+--    24.0000
+--   120.0000
+--   720.0001
+--  5040.0020
+-- 40319.9961
+-- 362880.0000
+-- 3628801.7500
 factorial
   :: AFType a
   => Array a
@@ -1583,9 +1980,19 @@
 
 -- | Execute tgamma
 --
---
--- >>> 'tgamma' (vector @Int 10 [1..])
---
+-- >>> tgamma (vector @Int 10 [1..])
+-- ArrayFire Array
+-- [10 1 1 1]
+--     1.0000
+--     1.0000
+--     2.0000
+--     6.0000
+--    24.0000
+--   120.0000
+--   720.0001
+--  5040.0020
+-- 40319.9961
+-- 362880.0000
 tgamma
   :: AFType a
   => Array a
@@ -1599,7 +2006,16 @@
 -- >>> A.lgamma (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.0000     0.0000     0.6931     1.7918     3.1781     4.7875     6.5793     8.5252    10.6046    12.8018
+--     0.0000
+--     0.0000
+--     0.6931
+--     1.7918
+--     3.1781
+--     4.7875
+--     6.5793
+--     8.5252
+--    10.6046
+--    12.8018
 lgamma
   :: AFType a
   => Array a
@@ -1613,7 +2029,16 @@
 -- >>> A.isZero (A.vector @CBool 10 (repeat 0))
 -- ArrayFire Array
 -- [10 1 1 1]
---         1          1          1          1          1          1          1          1          1          1
+--          1
+--          1
+--          1
+--          1
+--          1
+--          1
+--          1
+--          1
+--          1
+--          1
 isZero
   :: AFType a
   => Array a
@@ -1627,7 +2052,16 @@
 -- >>> A.isInf (A.vector @Double 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---         0          0          0          0          0          0          0          0          0          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
+--          0
 isInf
   :: (Real a, AFType a)
   => Array a
@@ -1641,7 +2075,16 @@
 -- >>> A.isNaN $ A.acos (A.vector @Int 10 [1..])
 -- ArrayFire Array
 -- [10 1 1 1]
---         0          1          1          1          1          1          1          1          1          1
+--          0
+--          1
+--          1
+--          1
+--          1
+--          1
+--          1
+--          1
+--          1
+--          1
 isNaN
   :: forall a. (AFType a, Real a)
   => Array a
diff --git a/src/ArrayFire/Array.hs b/src/ArrayFire/Array.hs
--- a/src/ArrayFire/Array.hs
+++ b/src/ArrayFire/Array.hs
@@ -30,8 +30,8 @@
 -- @
 -- ArrayFire Array
 -- [2 2 1 1]
---    1.0000     2.0000
---    1.0000     2.0000
+--     1.0000     1.0000
+--     2.0000     2.0000
 -- @
 --------------------------------------------------------------------------------
 module ArrayFire.Array where
@@ -69,7 +69,16 @@
 -- >>> vector @Double 10 [1..]
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.0000     2.0000     3.0000     4.0000     5.0000     6.0000     7.0000     8.0000     9.0000    10.0000
+--     1.0000
+--     2.0000
+--     3.0000
+--     4.0000
+--     5.0000
+--     6.0000
+--     7.0000
+--     8.0000
+--     9.0000
+--    10.0000
 vector :: AFType a => Int -> [a] -> Array a
 vector n = mkArray [n] . take n
 
@@ -147,8 +156,16 @@
 -- >>> mkArray @Double [10] [1.0 .. 10.0]
 -- ArrayFire Array
 -- [10 1 1 1]
---    1.0000     2.0000     3.0000     4.0000     5.0000     6.0000     7.0000     8.0000     9.0000    10.0000
---
+--     1.0000
+--     2.0000
+--     3.0000
+--     4.0000
+--     5.0000
+--     6.0000
+--     7.0000
+--     8.0000
+--     9.0000
+--    10.0000
 mkArray
   :: forall array
    . AFType array
diff --git a/src/ArrayFire/BLAS.hs b/src/ArrayFire/BLAS.hs
--- a/src/ArrayFire/BLAS.hs
+++ b/src/ArrayFire/BLAS.hs
@@ -15,18 +15,18 @@
 -- main = print (matmul x y xProp yProp)
 --  where
 --     x,y :: Array Double
---     x = matrix (2,3) [1..]
---     y = matrix (3,2) [1..]
+--     x = matrix (2,3) [[1,2],[3,4],[5,6]]
+--     y = matrix (3,2) [[1,2,3],[4,5,6]]
 --
 --     xProp, yProp :: MatProp
 --     xProp = None
 --     yProp = None
 -- @
 -- @
--- ArrayFire Array
--- [2 2 1 1]
---   22.0000    28.0000
---   49.0000    64.0000
+--  ArrayFire Array
+--  [2 2 1 1]
+--     22.0000    49.0000
+--     28.0000    64.0000
 -- @
 --------------------------------------------------------------------------------
 module ArrayFire.BLAS where
@@ -52,8 +52,8 @@
 -- >>> matmul (matrix @Double (2,2) [[1,2],[3,4]]) (matrix @Double (2,2) [[1,2],[3,4]]) None None
 -- ArrayFire Array
 -- [2 2 1 1]
---    7.0000    10.0000
---   15.0000    22.0000
+--     7.0000    15.0000
+--    10.0000    22.0000
 matmul
   :: Array a
   -- ^ 2D matrix of Array a, left-hand side
@@ -111,18 +111,19 @@
 
 -- | Transposes a matrix.
 --
--- >>> matrix @Double (2,3) [[2,3,4],[4,5,6]]
+-- >>> array = matrix @Double (2,3) [[2,3],[3,4],[5,6]]
+-- >>> array
 -- ArrayFire Array
 -- [2 3 1 1]
---    2.0000     3.0000
---    4.0000     4.0000
---    5.0000     6.0000
+--     2.0000     3.0000     5.0000
+--     3.0000     4.0000     6.0000
 --
--- >>> transpose (matrix @Double (2,3) [[2,3,4],[4,5,6]]) True
+-- >>> transpose array True
 -- ArrayFire Array
 -- [3 2 1 1]
---    2.0000     4.0000     5.0000
---    3.0000     4.0000     6.0000
+--     2.0000     3.0000
+--     3.0000     4.0000
+--     5.0000     6.0000
 --
 transpose
   :: Array a
@@ -138,9 +139,20 @@
 --
 -- * Warning: This function mutates an array in-place, all subsequent references will be changed. Use carefully.
 --
--- >>> array = matrix @Double (2,2) [[1..2],[3..4]]
+-- >>> array = matrix @Double (2,2) [[1,2],[3,4]]
+-- >>> array
+-- ArrayFire Array
+-- [3 2 1 1]
+--    1.0000     4.0000
+--    2.0000     5.0000
+--    3.0000     6.0000
+--
 -- >>> transposeInPlace array False
--- ()
+-- >>> array
+-- ArrayFire Array
+-- [2 2 1 1]
+--    1.0000     2.0000
+--    3.0000     4.0000
 --
 transposeInPlace
   :: Array a
diff --git a/src/ArrayFire/Data.hs b/src/ArrayFire/Data.hs
--- a/src/ArrayFire/Data.hs
+++ b/src/ArrayFire/Data.hs
@@ -16,6 +16,16 @@
 -- Stability   : Experimental
 -- Portability : GHC
 --
+-- Functions for populating 'Array' with Data.
+--
+-- @
+-- >>> constant @Double [2,2] 2.0
+--  ArrayFire Array
+-- [2 2 1 1]
+--    2.0000     2.0000
+--    2.0000     2.0000
+-- @
+--
 --------------------------------------------------------------------------------
 module ArrayFire.Data where
 
@@ -184,7 +194,16 @@
 -- >>> range @Double [10] (-1)
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.0000     1.0000     2.0000     3.0000     4.0000     5.0000     6.0000     7.0000     8.0000     9.0000
+--     0.0000
+--     1.0000
+--     2.0000
+--     3.0000
+--     4.0000
+--     5.0000
+--     6.0000
+--     7.0000
+--     8.0000
+--     9.0000
 range
   :: forall a
    . AFType a
@@ -211,19 +230,20 @@
 -- >>> iota @Double [5,3] []
 -- ArrayFire Array
 -- [5 3 1 1]
---    0.0000     1.0000     2.0000     3.0000     4.0000
---    5.0000     6.0000     7.0000     8.0000     9.0000
---   10.0000    11.0000    12.0000    13.0000    14.0000
+--     0.0000     5.0000    10.0000
+--     1.0000     6.0000    11.0000
+--     2.0000     7.0000    12.0000
+--     3.0000     8.0000    13.0000
+--     4.0000     9.0000    14.0000
 --
 -- >>> iota @Double [5,3] [1,2]
 -- ArrayFire Array
 -- [5 6 1 1]
---  0.0000     1.0000     2.0000     3.0000     4.0000
---  5.0000     6.0000     7.0000     8.0000     9.0000
--- 10.0000    11.0000    12.0000    13.0000    14.0000
---  0.0000     1.0000     2.0000     3.0000     4.0000
---  5.0000     6.0000     7.0000     8.0000     9.0000
--- 10.0000    11.0000    12.0000    13.0000    14.0000
+--     0.0000     5.0000    10.0000     0.0000     5.0000    10.0000
+--     1.0000     6.0000    11.0000     1.0000     6.0000    11.0000
+--     2.0000     7.0000    12.0000     2.0000     7.0000    12.0000
+--     3.0000     8.0000    13.0000     3.0000     8.0000    13.0000
+--     4.0000     9.0000    14.0000     4.0000     9.0000    14.0000
 iota
   :: forall a . AFType a
   => [Int]
@@ -297,7 +317,8 @@
 -- >>> diagExtract (matrix @Double (2,2) [[1,2],[3,4]]) 0
 -- ArrayFire Array
 -- [2 1 1 1]
---    1.0000     4.0000
+--     1.0000
+--     4.0000
 diagExtract
   :: AFType (a :: *)
   => Array a
@@ -311,8 +332,10 @@
 -- >>> join 0 (matrix @Double (2,2) [[1,2],[3,4]]) (matrix @Double (2,2) [[5,6],[7,8]])
 -- ArrayFire Array
 -- [4 2 1 1]
---    1.0000     2.0000     5.0000     6.0000
---    3.0000     4.0000     7.0000     8.0000
+--     1.0000     3.0000
+--     2.0000     4.0000
+--     5.0000     7.0000
+--     6.0000     8.0000
 --
 join
   :: Int
@@ -394,7 +417,10 @@
 -- >>> shift (vector @Double 4 [1..]) 2 0 0 0
 -- ArrayFire Array
 -- [4 1 1 1]
---    3.0000     4.0000     1.0000     2.0000
+--     3.0000
+--     4.0000
+--     1.0000
+--     2.0000
 --
 shift
   :: Array (a :: *)
@@ -411,9 +437,7 @@
 -- >>> moddims (vector @Double 3 [1..]) [1,3]
 -- ArrayFire Array
 -- [1 3 1 1]
---    1.0000
---    2.0000
---    3.0000
+--     1.0000     2.0000     3.0000
 --
 moddims
   :: forall a
@@ -436,12 +460,22 @@
 -- >>> flat (matrix @Double (2,2) [[1..],[1..]])
 -- ArrayFire Array
 -- [4 1 1 1]
---    1.0000     2.0000     1.0000     2.0000
+--     1.0000
+--     2.0000
+--     1.0000
+--     2.0000
 --
 -- >>> flat $ cube @Int (2,2,2) [[[1,1],[1,1]],[[1,1],[1,1]]]
 -- ArrayFire Array
 -- [8 1 1 1]
---     1          1          1          1          1          1          1          1
+--          1
+--          1
+--          1
+--          1
+--          1
+--          1
+--          1
+--          1
 --
 flat
   :: Array a
@@ -453,14 +487,14 @@
 -- >>> matrix @Double (2,2) [[2,2],[3,3]]
 -- ArrayFire Array
 -- [2 2 1 1]
---    2.0000     2.0000
---    3.0000     3.0000
+--     2.0000     3.0000
+--     2.0000     3.0000
 --
 -- >>> A.flip (matrix @Double (2,2) [[2,2],[3,3]]) 1
 -- ArrayFire Array
 -- [2 2 1 1]
---    3.0000     3.0000
---    2.0000     2.0000
+--     3.0000     2.0000
+--     3.0000     2.0000
 --
 flip
   :: Array a
@@ -474,8 +508,8 @@
 -- >>> lower (constant [2,2] 10 :: Array Double) True
 -- ArrayFire Array
 -- [2 2 1 1]
---    1.0000    10.0000
---    0.0000     1.0000
+--     1.0000     0.0000
+--    10.0000     1.0000
 --
 lower
   :: Array a
@@ -491,8 +525,8 @@
 -- >>> upper (constant [2,2] 10 :: Array Double) True
 -- ArrayFire Array
 -- [2 2 1 1]
---    1.0000     0.0000
---   10.0000     1.0000
+--    1.0000     10.0000
+--    0.0000     1.0000
 --
 upper
   :: Array a
@@ -509,7 +543,11 @@
 -- >>> select cond arr1 arr2
 -- ArrayFire Array
 -- [5 1 1 1]
---    1.0000     2.0000     1.0000     2.0000     1.0000
+--     1.0000
+--     2.0000
+--     1.0000
+--     2.0000
+--     1.0000
 --
 select
   :: Array CBool
@@ -529,10 +567,14 @@
 -- >>> cond = vector @CBool 5 [1,0,1,0,1]
 -- >>> arr1 = vector @Double 5 (repeat 1)
 -- >>> x = 99
--- >>> selectScalarR cond x arr1
+-- >>> selectScalarR cond arr1 x
 -- ArrayFire Array
 -- [5 1 1 1]
---    1.0000    99.0000     1.0000    99.0000     1.0000
+--     1.0000
+--    99.0000
+--     1.0000
+--    99.0000
+--     1.0000
 --
 selectScalarR
   :: Array CBool
@@ -555,7 +597,11 @@
 -- >>> selectScalarL cond x arr1
 -- ArrayFire Array
 -- [5 1 1 1]
---   99.0000     1.0000    99.0000     1.0000    99.0000
+--    99.0000
+--     1.0000
+--    99.0000
+--     1.0000
+--    99.0000
 --
 selectScalarL
   :: Array CBool
diff --git a/src/ArrayFire/Features.hs b/src/ArrayFire/Features.hs
--- a/src/ArrayFire/Features.hs
+++ b/src/ArrayFire/Features.hs
@@ -8,6 +8,12 @@
 -- Stability   : Experimental
 -- Portability : GHC
 --
+-- Functions for constructing and querying 'Features'
+--
+-- @
+-- >>> createFeatures 10
+-- @
+--
 --------------------------------------------------------------------------------
 module ArrayFire.Features where
 
@@ -23,7 +29,7 @@
 
 -- | Construct Features
 --
--- >>> features = createFeatures (createFeatures 10)
+-- >>> features = createFeatures 10
 --
 createFeatures
   :: Int
@@ -63,8 +69,16 @@
 -- >>> getFeaturesXPos (createFeatures 10)
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.0000     0.0000     0.0000     0.0000     0.0000     2.1250     0.0000     2.2500     0.0000     0.0000
---
+--     0.0000
+--     1.8750
+--     0.0000
+--     2.3750
+--     0.0000
+--     2.5938
+--     0.0000
+--     2.0000
+--     0.0000
+--     2.4375
 getFeaturesXPos
   :: Features
   -> Array a
@@ -75,8 +89,16 @@
 -- >>> getFeaturesYPos (createFeatures 10)
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.0000     0.0000     0.0000     0.0000     0.0000     0.0000     0.0000     0.0000     0.0000     0.0000
---
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
 getFeaturesYPos
   :: Features
   -> Array a
@@ -87,8 +109,16 @@
 -- >>> getFeaturesScore (createFeatures 10)
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.0000     1.8750     0.0000     2.0000     0.0000     2.1250     0.0000     2.2500        nan        nan
---
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
 getFeaturesScore
   :: Features
   -> Array a
@@ -99,8 +129,16 @@
 -- >>> getFeaturesOrientation (createFeatures 10)
 -- ArrayFire Array
 -- [10 1 1 1]
---    0.0000     1.8750     0.0000     2.0000     0.0000     2.1250     0.0000     2.2500     0.0000     0.0000
---
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
 getFeaturesOrientation
   :: Features
   -> Array a
@@ -111,8 +149,16 @@
 -- >>> getFeaturesSize (createFeatures 10)
 -- ArrayFire Array
 -- [10 1 1 1]
---       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan
---
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
+--        nan
 getFeaturesSize
   :: Features
   -> Array a
diff --git a/src/ArrayFire/Graphics.hs b/src/ArrayFire/Graphics.hs
--- a/src/ArrayFire/Graphics.hs
+++ b/src/ArrayFire/Graphics.hs
@@ -8,6 +8,12 @@
 -- Stability   : Experimental
 -- Portability : GHC
 --
+-- Functions for displaying 'Array' graphically.
+--
+-- @
+-- >>> window <- createWindow 800 600 "New Chart"
+-- @
+--
 --------------------------------------------------------------------------------
 module ArrayFire.Graphics where
 
@@ -98,7 +104,7 @@
 -- [ArrayFire Docs](http://arrayfire.org/docs/group__gfx__func__draw.htm)
 --
 -- >>> drawImage window ('constant' \@'Int' 1) ('Cell' 10 10 "test" 'ColorMapSpectrum')
--- 
+--
 drawImage
   :: Window
   -- ^ 'Window' handle
@@ -113,7 +119,6 @@
       alloca $ \cellPtr -> do
         poke cellPtr =<< cellToAFCell cell
         throwAFError =<< af_draw_image wptr aptr cellPtr
-        free cellPtr
 
 -- | Draw a plot onto a 'Window'
 --
@@ -140,7 +145,6 @@
       alloca $ \cellPtr -> do
         poke cellPtr =<< cellToAFCell cell
         throwAFError =<< af_draw_plot wptr ptr1 ptr2 cellPtr
-        free cellPtr
 
 -- | Draw a plot onto a 'Window'
 --
@@ -162,7 +166,6 @@
     alloca $ \cellPtr -> do
       poke cellPtr =<< cellToAFCell cell
       throwAFError =<< af_draw_plot3 wptr aptr cellPtr
-      free cellPtr
 
 -- | Draw a plot onto a 'Window'
 --
@@ -184,7 +187,6 @@
     alloca $ \cellPtr -> do
       poke cellPtr =<< cellToAFCell cell
       throwAFError =<< af_draw_plot_nd wptr aptr cellPtr
-      free cellPtr
 
 -- | Draw a plot onto a 'Window'
 --
@@ -209,7 +211,6 @@
       alloca $ \cellPtr -> do
         poke cellPtr =<< cellToAFCell cell
         throwAFError =<< af_draw_plot_2d wptr ptr1 ptr2 cellPtr
-        free cellPtr
 
 -- | Draw a 3D plot onto a 'Window'
 --
@@ -237,7 +238,6 @@
           alloca $ \cellPtr -> do
             poke cellPtr =<< cellToAFCell cell
             throwAFError =<< af_draw_plot_3d wptr ptr1 ptr2 ptr3 cellPtr
-            free cellPtr
 
 -- | Draw a scatter plot onto a 'Window'
 --
@@ -264,7 +264,6 @@
       alloca $ \cellPtr -> do
         poke cellPtr =<< cellToAFCell cell
         throwAFError =<< af_draw_scatter wptr ptr1 ptr2 m cellPtr
-        free cellPtr
 
 -- | Draw a scatter plot onto a 'Window'
 --
@@ -288,7 +287,6 @@
     alloca $ \cellPtr -> do
       poke cellPtr =<< cellToAFCell cell
       throwAFError =<< af_draw_scatter3 wptr ptr1 m cellPtr
-      free cellPtr
 
 -- | Draw a scatter plot onto a 'Window'
 --
@@ -312,7 +310,6 @@
     alloca $ \cellPtr -> do
       poke cellPtr =<< cellToAFCell cell
       throwAFError =<< af_draw_scatter_nd wptr ptr1 m cellPtr
-      free cellPtr
 
 -- | Draw a scatter plot onto a 'Window'
 --
@@ -339,7 +336,6 @@
     alloca $ \cellPtr -> do
       poke cellPtr =<< cellToAFCell cell
       throwAFError =<< af_draw_scatter_2d wptr ptr1 ptr2 m cellPtr
-      free cellPtr
 
 -- | Draw a scatter plot onto a 'Window'
 --
@@ -355,7 +351,7 @@
   -> Array a
   -- ^ is an af_array with the y-axis data points
   -> Array a
-  -- ^ is an af_array with the z-axis data points  
+  -- ^ is an af_array with the z-axis data points
   -> MarkerType
   -- ^ is an af_marker_type enum specifying which marker to use in the scatter plot
   -> Cell
@@ -369,7 +365,6 @@
       alloca $ \cellPtr -> do
         poke cellPtr =<< cellToAFCell cell
         throwAFError =<< af_draw_scatter_3d wptr ptr1 ptr2 ptr3 m cellPtr
-        free cellPtr
 
 -- | Draw a Histogram onto a 'Window'
 --
@@ -422,7 +417,6 @@
       alloca $ \cellPtr -> do
         poke cellPtr =<< cellToAFCell cell
         throwAFError =<< af_draw_surface wptr ptr1 ptr2 ptr3 cellPtr
-        free cellPtr
 
 -- | Draw a Vector Field onto a 'Window'
 --
@@ -447,7 +441,6 @@
       alloca $ \cellPtr -> do
         poke cellPtr =<< cellToAFCell cell
         throwAFError =<< af_draw_vector_field_nd wptr ptr1 ptr2 cellPtr
-        free cellPtr
 
 -- | Draw a Vector Field onto a 'Window'
 --
@@ -486,7 +479,6 @@
                 alloca $ \cellPtr -> do
                   poke cellPtr =<< cellToAFCell cell
                   throwAFError =<< af_draw_vector_field_3d wptr ptr1 ptr2 ptr3 ptr4 ptr5 ptr6 cellPtr
-                  free cellPtr
 
 -- | Draw a Vector Field onto a 'Window'
 --
@@ -518,7 +510,6 @@
             alloca $ \cellPtr -> do
               poke cellPtr =<< cellToAFCell cell
               throwAFError =<< af_draw_vector_field_2d wptr ptr1 ptr2 ptr3 ptr4 cellPtr
-              free cellPtr
 
 -- | Draw a grid onto a 'Window'
 --
@@ -567,7 +558,6 @@
           alloca $ \cellPtr -> do
             poke cellPtr =<< cellToAFCell cell
             throwAFError =<< af_set_axes_limits_compute wptr ptr1 ptr2 ptr3 exact cellPtr
-            free cellPtr
 
 -- | Setting axes limits for a 2D histogram/plot/surface/vector field.
 --
@@ -595,7 +585,6 @@
     alloca $ \cellPtr -> do
       poke cellPtr =<< cellToAFCell cell
       throwAFError =<< af_set_axes_limits_2d wptr xmin xmax ymin ymax exact cellPtr
-      free cellPtr
 
 -- | Setting axes limits for a 3D histogram/plot/surface/vector field.
 --
@@ -627,7 +616,6 @@
     alloca $ \cellPtr -> do
       poke cellPtr =<< cellToAFCell cell
       throwAFError =<< af_set_axes_limits_3d wptr xmin xmax ymin ymax zmin zmax exact cellPtr
-      free cellPtr
 
 
 -- | Setting axes titles
@@ -655,7 +643,6 @@
           withCString z $ \zstr -> do
             poke cellPtr =<< cellToAFCell cell
             throwAFError =<< af_set_axes_titles wptr xstr ystr zstr cellPtr
-            free cellPtr
 
 -- | Displays 'Window'
 --
diff --git a/src/ArrayFire/Image.hs b/src/ArrayFire/Image.hs
--- a/src/ArrayFire/Image.hs
+++ b/src/ArrayFire/Image.hs
@@ -10,6 +10,12 @@
 -- Stability   : Experimental
 -- Portability : GHC
 --
+-- Functions for loading and manipulating images with 'Array'
+--
+-- @
+-- >>> image <- 'loadImage' "image.png" True
+-- @
+--
 --------------------------------------------------------------------------------
 module ArrayFire.Image where
 
@@ -380,7 +386,7 @@
 minFilt in' (fromIntegral -> a) (fromIntegral -> b) (fromBorderType -> c) =
   in' `op1` (\ptr k -> af_minfilt ptr k a b c)
 
--- | Find maximum value from a window. 
+-- | Find maximum value from a window.
 --
 -- [ArrayFire Docs](http://arrayfire.org/docs/group__image__func__maxfilt.htm)
 --
@@ -518,7 +524,7 @@
 -- C Interface for converting HSV to RGB.
 --
 -- *Note* input must be three dimensional
--- 
+--
 hsv2rgb
   :: Array a
   -- ^ is an array in the HSV color space
@@ -657,7 +663,7 @@
 rgb2ycbcr a y = a `op1` (\p k -> af_rgb2ycbcr p k (fromAFYccStd y))
 
 -- | Finding different properties of image regions.
--- 
+--
 -- [ArrayFire Docs](http://arrayfire.org/docs/group__image__func__moments.htm)
 --
 -- C Interface for calculating image moment(s) of a single image.
@@ -673,7 +679,7 @@
   in' `op1` (\p k -> af_moments p k (fromMomentType m))
 
 -- | Finding different properties of image regions.
--- 
+--
 -- [ArrayFire Docs](http://arrayfire.org/docs/group__image__func__moments.htm)
 --
 -- C Interface for calculating image moment(s) of a single image.
@@ -689,7 +695,7 @@
   in' `infoFromArray` (\p a -> af_moments_all p a (fromMomentType m))
 
 -- | Canny Edge Detector
--- 
+--
 -- [ArrayFire Docs](http://arrayfire.org/docs/group__image__func__canny.htm)
 --
 -- The Canny edge detector is an edge detection operator that uses a multi-stage algorithm to detect a wide range of edges in images.
@@ -713,7 +719,7 @@
   in' `op1` (\p a -> af_canny p a canny' low high window fast)
 
 -- | Anisotropic Smoothing Filter.
--- 
+--
 -- [ArrayFire Docs](http://arrayfire.org/docs/group__image__func__anisotropic__diffusion.htm)
 --
 -- C Interface for anisotropic diffusion.
diff --git a/src/ArrayFire/Index.hs b/src/ArrayFire/Index.hs
--- a/src/ArrayFire/Index.hs
+++ b/src/ArrayFire/Index.hs
@@ -7,6 +7,8 @@
 -- Stability   : Experimental
 -- Portability : GHC
 --
+-- Functions for indexing into an 'Array'
+--
 --------------------------------------------------------------------------------
 module ArrayFire.Index where
 
diff --git a/src/ArrayFire/Internal/Defines.hsc b/src/ArrayFire/Internal/Defines.hsc
--- a/src/ArrayFire/Internal/Defines.hsc
+++ b/src/ArrayFire/Internal/Defines.hsc
@@ -43,8 +43,10 @@
  }
 
 -- | Low-level for representation of ArrayFire types
-newtype AFDtype
-  = AFDtype
+
+-- | AFDType
+-- Newtype over ArrayFire's internal type tag
+newtype AFDtype = AFDtype
   { afDType :: CInt
   -- ^ Value corresponding to ArrayFire type
   } deriving (Show, Eq, Storable)
diff --git a/src/ArrayFire/LAPACK.hs b/src/ArrayFire/LAPACK.hs
--- a/src/ArrayFire/LAPACK.hs
+++ b/src/ArrayFire/LAPACK.hs
@@ -7,6 +7,33 @@
 -- Maintainer  : David Johnson <djohnson.m@gmail.com>
 -- Stability   : Experimental
 -- Portability : GHC
+--
+-- LAPACK — Linear Algebra PACKage
+--
+-- @
+-- >>> (u,e,d) = svd (constant @Double [3,3] 10)
+-- >>> u
+-- ArrayFire Array
+-- [3 3 1 1]
+--    -0.5774     0.8165    -0.0000
+--    -0.5774    -0.4082    -0.7071
+--    -0.5774    -0.4082     0.7071
+--
+-- >>> e
+-- ArrayFire Array
+-- [3 1 1 1]
+--    30.0000
+--     0.0000
+--     0.0000
+--
+-- >>> d
+-- ArrayFire Array
+-- [3 3 1 1]
+--   -0.5774    -0.5774    -0.5774
+--   -0.8165     0.4082     0.4082
+--   -0.0000     0.7071    -0.7071
+--
+-- @
 --------------------------------------------------------------------------------
 module ArrayFire.LAPACK where
 
@@ -206,7 +233,7 @@
 --   -> MatProp
 --   -> Array a
 -- pinverse a d m =
---   a `op1` (\x y  -> af_pinverse x y d (toMatProp m))
+--   op1 a (\x y  -> af_pinverse x y d (toMatProp m))
 
 -- | Find the rank of the input matrix
 --
diff --git a/src/ArrayFire/Random.hs b/src/ArrayFire/Random.hs
--- a/src/ArrayFire/Random.hs
+++ b/src/ArrayFire/Random.hs
@@ -301,13 +301,13 @@
 
 -- | Generate random uniform 'Array'
 --
--- >>> randonUniform @Double [2,2] =<< getDefaultRandomEngine
+-- >>> randomUniform @Double [2,2] =<< getDefaultRandomEngine
 --
 -- @
 -- ArrayFire Array
 -- [2 2 1 1]
---    0.0655     0.5497
---    0.2864     0.3410
+--     0.6010     0.9806
+--     0.0278     0.2126
 -- @
 --
 randomUniform
@@ -322,13 +322,13 @@
 
 -- | Generate random uniform 'Array'
 --
--- >>> randonNormal @Double [2,2] =<< getDefaultRandomEngine
+-- >>> randomNormal @Double [2,2] =<< getDefaultRandomEngine
 --
 -- @
 -- ArrayFire Array
 -- [2 2 1 1]
---   -1.1850    -0.2946
---   -0.7206    -0.6813
+--    -1.4394     0.1952
+--     0.7982    -0.9783
 -- @
 --
 randomNormal
diff --git a/src/ArrayFire/Signal.hs b/src/ArrayFire/Signal.hs
--- a/src/ArrayFire/Signal.hs
+++ b/src/ArrayFire/Signal.hs
@@ -10,6 +10,19 @@
 --
 -- [ArrayFire Docs](http://arrayfire.org/docs/group__signal__func__fft.htm)
 --
+-- Functions performing signal processing on 'Array'
+--
+-- >>> input = vector 3 [10,20,30]
+-- >>> positions = vector 5 [0.0, 0.5, 1.0, 1.5, 2.0]
+-- >>> approx1 @Double input positions Cubic 0.0
+-- ArrayFire Array
+-- [5 1 1 1]
+--    10.0000
+--    13.7500
+--    20.0000
+--    26.2500
+--    30.0000
+--
 --------------------------------------------------------------------------------
 module ArrayFire.Signal where
 
@@ -30,8 +43,11 @@
 -- >>> approx1 @Double input positions Cubic 0.0
 -- ArrayFire Array
 -- [5 1 1 1]
---   10.0000    13.7500    20.0000    26.2500    30.0000
---
+--    10.0000
+--    13.7500
+--    20.0000
+--    26.2500
+--    30.0000
 approx1
   :: AFType a
   => Array a
@@ -59,8 +75,8 @@
 -- >>> approx2 @Double input positions1 positions2 Cubic 0.0
 -- ArrayFire Array
 -- [2 2 1 1]
---    1.3750     1.3750
---    2.6250     2.6250
+--     1.3750     2.6250
+--     1.3750     2.6250
 --
 approx2
   :: AFType a
@@ -119,10 +135,17 @@
 --
 -- >>> fft (vector @Double 10 [1..]) 2.0 10
 -- ArrayFire Array
--- [2 2 1 1]
---    1.3750     1.3750 
---    2.6250     2.6250
---
+-- [10 1 1 1]
+--          (110.0000,0.0000)
+--          (-10.0000,30.7768)
+--          (-10.0000,13.7638)
+--          (-10.0000,7.2654)
+--          (-10.0000,3.2492)
+--          (-10.0000,0.0000)
+--          (-10.0000,-3.2492)
+--          (-10.0000,-7.2654)
+--          (-10.0000,-13.7638)
+--          (-10.0000,-30.7768)
 fft
   :: (AFType a, Fractional a)
   => Array a
@@ -143,7 +166,7 @@
 -- C Interface for fast fourier transform on one dimensional signals.
 --
 -- *Note* The input in must be a complex array
--- 
+--
 fftInPlace
   :: (AFType a, Fractional a)
   => Array (Complex a)
@@ -158,7 +181,7 @@
 -- [ArrayFire Docs](http://arrayfire.org/docs/group__signal__func__fft2.htm#gaab3fb1ed398e208a615036b4496da611)
 --
 -- C Interface for fast fourier transform on two dimensional signals.
--- 
+--
 fft2
   :: AFType a
   => Array a
@@ -181,7 +204,7 @@
 -- C Interface for fast fourier transform on two dimensional signals.
 --
 -- *Note* The input in must be a complex array
--- 
+--
 fft2_inplace
   :: (Fractional a, AFType a)
   => Array (Complex a)
@@ -196,7 +219,7 @@
 -- [ArrayFire Docs](http://arrayfire.org/docs/group__signal__func__fft3.htm#ga5138ef1740ece0fde2c796904d733c12)
 --
 -- C Interface for fast fourier transform on three dimensional signals.
--- 
+--
 fft3
   :: AFType a
   => Array a
@@ -221,7 +244,7 @@
 -- C Interface for fast fourier transform on three dimensional signals.
 --
 -- *Note* The input in must be a complex array
--- 
+--
 fft3_inplace
   :: (Fractional a, AFType a)
   => Array (Complex a)
@@ -568,7 +591,7 @@
 -- fftConvolve1 a b (toConvMode -> c) = op2 a b (\x y z -> af_fft_convolve1 x y z c)
 
 -- | 2D Convolution using Fast Fourier Transform
---  
+--
 -- [ArrayFire Docs](http://arrayfire.org/docs/group__signal__func__fft__convolve2.htm#gab52ebe631d8358cdef1b5c8a95550556)
 --
 -- A convolution is a common operation between a source array, a, and a filter (or kernel) array b. The answer to the convolution is the same as computing the coefficients in polynomial multiplication, if a and b are the coefficients.
@@ -588,7 +611,7 @@
 fftConvolve2 a b (toConvMode -> c) = op2 a b (\x y z -> af_fft_convolve2 x y z c)
 
 -- | 3D Convolution using Fast Fourier Transform
---  
+--
 -- [ArrayFire Docs](http://arrayfire.org/docs/group__signal__func__fft__convolve3.htm)
 --
 -- A convolution is a common operation between a source array, a, and a filter (or kernel) array b. The answer to the convolution is the same as computing the coefficients in polynomial multiplication, if a and b are the coefficients.
diff --git a/src/ArrayFire/Sparse.hs b/src/ArrayFire/Sparse.hs
--- a/src/ArrayFire/Sparse.hs
+++ b/src/ArrayFire/Sparse.hs
@@ -106,13 +106,23 @@
 -- [2 2 1 1]
 -- ArrayFire Array: Values
 -- [4 1 1 1]
---     1.0000     3.0000     2.0000     4.0000
+--     1.0000
+--     3.0000
+--     2.0000
+--     4.0000
+
 -- ArrayFire Array: RowIdx
 -- [3 1 1 1]
---          0          2          4
+--          0
+--          2
+--          4
+
 -- ArrayFire Array: ColIdx
 -- [4 1 1 1]
---          0          1          0          1
+--          0
+--          1
+--          0
+--          1
 --
 -- >>> sparseConvertTo array COO
 -- ArrayFire Array
@@ -120,13 +130,24 @@
 -- [2 2 1 1]
 -- ArrayFire Array: Values
 -- [4 1 1 1]
---     1.0000     2.0000     3.0000     4.0000
+--     1.0000
+--     2.0000
+--     3.0000
+--     4.0000
+
 -- ArrayFire Array: RowIdx
 -- [4 1 1 1]
---          0          1          0          1
+--          0
+--          1
+--          0
+--          1
+
 -- ArrayFire Array: ColIdx
 -- [4 1 1 1]
---          0          0          1          1
+--          0
+--          0
+--          1
+--          1
 --
 sparseConvertTo
   :: (AFType a, Fractional a)
@@ -152,19 +173,23 @@
 -- [2 2 1 1]
 -- ArrayFire Array: Values
 -- [4 1 1 1]
---     1.0000     3.0000     2.0000     4.0000
+--     1.0000
+--     3.0000
+--     2.0000
+--     4.0000
+--
 -- ArrayFire Array: RowIdx
 -- [3 1 1 1]
---          0          2          4
+--          0
+--          2
+--          4
+--
 -- ArrayFire Array: ColIdx
 -- [4 1 1 1]
---          0          1          0          1
---
--- >>> sparseToDense array
--- ArrayFire Array
--- [2 2 1 1]
---     1.0000     2.0000
---     3.0000     4.0000
+--          0
+--          1
+--          0
+--          1
 --
 sparseToDense
   :: (AFType a, Fractional a)
@@ -182,17 +207,25 @@
 -- >>> values
 -- ArrayFire Array
 -- [4 1 1 1]
---    1.0000     3.0000     2.0000     4.0000
+--     1.0000
+--     3.0000
+--     2.0000
+--     4.0000
 --
 -- >>> cols
 -- ArrayFire Array
 -- [3 1 1 1]
---         0          2          4
+--          0
+--          2
+--          4
 --
 -- >>> rows
 -- ArrayFire Array
 -- [4 1 1 1]
---         0          1          0          1
+--          0
+--          1
+--          0
+--          1
 --
 -- >>> storage
 -- CSR
@@ -215,7 +248,10 @@
 -- >>> sparseGetValues (createSparseArrayFromDense (matrix @Double (2,2) [[1,2],[3,4]]) CSR)
 -- ArrayFire Array
 -- [4 1 1 1]
---    1.0000     3.0000     2.0000     4.0000
+--     1.0000
+--     3.0000
+--     2.0000
+--     4.0000
 --
 sparseGetValues
   :: (AFType a, Fractional a)
@@ -233,7 +269,9 @@
 -- >>> sparseGetRowIdx (createSparseArrayFromDense (matrix @Double (2,2) [[1,2],[3,4]]) CSR)
 -- ArrayFire Array
 -- [3 1 1 1]
---         0          2          4
+--          0
+--          2
+--          4
 --
 sparseGetRowIdx
   :: (AFType a, Fractional a)
@@ -251,7 +289,10 @@
 -- >>> sparseGetColIdx (createSparseArrayFromDense (matrix @Double (2,2) [[1,2],[3,4]]) CSR)
 -- ArrayFire Array
 -- [4 1 1 1]
---         0          1          0          1
+--          0
+--          1
+--          0
+--          1
 --
 sparseGetColIdx
   :: (AFType a, Fractional a)
@@ -292,4 +333,3 @@
   -> Int
 sparseGetNNZ a =
   fromIntegral (a `infoFromArray` af_sparse_get_nnz)
-
diff --git a/src/ArrayFire/Statistics.hs b/src/ArrayFire/Statistics.hs
--- a/src/ArrayFire/Statistics.hs
+++ b/src/ArrayFire/Statistics.hs
@@ -14,18 +14,21 @@
 --
 -- @
 -- >>> let (vals,indexes) = 'topk' ( 'vector' \@'Double' 10 [1..] ) 3 'TopKDefault'
--- >>> print vals
--- >>> print indexes
--- @
--- @
--- ArrayFire 'Array'
+-- >>> vals
+--
+-- ArrayFire Array
 -- [3 1 1 1]
---   10.0000     9.0000     8.0000
--- @
--- @
--- ArrayFire 'Array'
+--    10.0000
+--     9.0000
+--     8.0000
+--
+-- >>> indexes
+--
+-- ArrayFire Array
 -- [3 1 1 1]
---    9          8          7
+--          9
+--          8
+--          7
 -- @
 --------------------------------------------------------------------------------
 module ArrayFire.Statistics where
@@ -78,7 +81,7 @@
 -- >>> var (vector @Double 8 [1..8]) False 0
 -- ArrayFire Array
 --   [1 1 1 1]
---      6.0
+--      6.0000
 var
   :: AFType a
   => Array a
@@ -95,10 +98,10 @@
 
 -- | Calculates 'varWeighted' of 'Array' along user-specified dimension.
 --
--- >>> varWeighted ( vector @Int 10 [1..] ) ( vector @Int 10 [1..] ) 0
+-- >>> varWeighted ( vector @Double 10 [1..] ) ( vector @Double 10 [1..] ) 0
 -- ArrayFire Array
 --   [1 1 1 1]
---      5.5000
+--      6.0000
 varWeighted
   :: AFType a
   => Array a
@@ -118,7 +121,7 @@
 -- >>> stdev (vector @Double 10 (cycle [1,-1])) 0
 -- ArrayFire Array
 --   [1 1 1 1]
---      1.0
+--      1.0000
 stdev
   :: AFType a
   => Array a
@@ -136,7 +139,7 @@
 -- >>> cov (vector @Double 10 (repeat 1)) (vector @Double 10 (repeat 1)) False
 -- ArrayFire Array
 --   [1 1 1 1]
---      0.0
+--      0.0000
 cov
   :: AFType a
   => Array a
@@ -153,7 +156,7 @@
 
 -- | Calculates 'median' of 'Array' along user-specified dimension.
 --
--- >>> print $ median ( vector @Int 10 [1..] ) 0
+-- >>> median ( vector @Double 10 [1..] ) 0
 -- ArrayFire Array
 --   [1 1 1 1]
 --      5.5000
@@ -171,8 +174,8 @@
 
 -- | Calculates 'mean' of all elements in an 'Array'
 --
--- >>> fst (meanAll (matrix @Double (2,2) (repeat 10)))
--- 10.0
+-- >>> meanAll $ matrix @Double (2,2) [[1,2],[4,5]]
+-- (3.0,2.232709401e-314)
 meanAll
   :: AFType a
   => Array a
@@ -183,8 +186,8 @@
 
 -- | Calculates weighted mean of all elements in an 'Array'
 --
--- >>> print $ fst (meanAllWeighted (matrix @Double (2,2) (repeat 10)) (matrix @Double (2,2) (repeat 0)))
--- 10
+-- >>> meanAllWeighted (matrix @Double (2,2) [[1,2],[3,4]]) (matrix @Double (2,2) [[1,2],[3,4]])
+-- (3.0,1.400743288453e-312)
 meanAllWeighted
   :: AFType a
   => Array a
@@ -198,8 +201,8 @@
 
 -- | Calculates variance of all elements in an 'Array'
 --
--- >>> fst (varAll (vector @Double 10 (repeat 10)) False)
--- 0
+-- >>> varAll (vector @Double 10 (repeat 10)) False
+-- (0.0,1.4013073623e-312)
 varAll
   :: AFType a
   => Array a
@@ -214,8 +217,8 @@
 
 -- | Calculates weighted variance of all elements in an 'Array'
 --
--- >>> varAllWeighted ( vector @Int 10 [1..] ) ( vector @Int 10 [1..] )
--- 0
+-- >>> varAllWeighted ( vector @Double 10 [1..] ) ( vector @Double 10 [1..] )
+-- (6.0,2.1941097984e-314)
 varAllWeighted
   :: AFType a
   => Array a
@@ -229,8 +232,8 @@
 
 -- | Calculates standard deviation of all elements in an 'Array'
 --
--- >>> fst (stdevAll (vector @Double 10 (repeat 10)))
--- 10
+-- >>> stdevAll (vector @Double 10 (repeat 10))
+-- (0.0,2.190573324e-314)
 stdevAll
   :: AFType a
   => Array a
@@ -241,8 +244,8 @@
 
 -- | Calculates median of all elements in an 'Array'
 --
--- >>> fst (medianAll (vector @Double 10 (repeat 10)))
--- 10
+-- >>> medianAll (vector @Double 10 (repeat 10))
+-- (10.0,2.1961564713e-314)
 medianAll
   :: (AFType a, Fractional a)
   => Array a
@@ -254,8 +257,8 @@
 -- | This algorithm returns Pearson product-moment correlation coefficient.
 -- <https://en.wikipedia.org/wiki/Pearson_correlation_coefficient>
 --
--- >>> fst (corrCoef ( vector @Int 10 [1..] ) ( vector @Int 10 [10,9..] ))
--- -1
+-- >>> corrCoef ( vector @Int 10 [1..] ) ( vector @Int 10 [10,9..] )
+-- (-1.0,2.1904819737e-314)
 corrCoef
   :: AFType a
   => Array a
@@ -271,16 +274,20 @@
 --
 -- @
 -- >>> let (vals,indexes) = 'topk' ( 'vector' \@'Double' 10 [1..] ) 3 'TopKDefault'
--- >>> print indexes
+-- >>> indexes
 --
--- ArrayFire 'Array'
+-- ArrayFire Array
 -- [3 1 1 1]
---   10.0000     9.0000     8.0000
+--          9
+--          8
+--          7
 --
--- >>> print vals
--- ArrayFire 'Array'
+-- >>> vals
+-- ArrayFire Array
 -- [3 1 1 1]
---    9          8          7
+--    10.0000
+--     9.0000
+--     8.0000
 -- @
 --
 -- The indices along with their values are returned. If the input is a multi-dimensional array, the indices will be the index of the value in that dimension. Order of duplicate values are not preserved. This function is optimized for small values of k.
diff --git a/src/ArrayFire/Types.hs b/src/ArrayFire/Types.hs
--- a/src/ArrayFire/Types.hs
+++ b/src/ArrayFire/Types.hs
@@ -20,6 +20,8 @@
 -- Stability   : Experimental
 -- Portability : GHC
 --
+-- Various Types related to the ArrayFire API
+--
 --------------------------------------------------------------------------------
 module ArrayFire.Types
   ( AFException         (..)
diff --git a/src/ArrayFire/Vision.hs b/src/ArrayFire/Vision.hs
--- a/src/ArrayFire/Vision.hs
+++ b/src/ArrayFire/Vision.hs
@@ -10,6 +10,8 @@
 -- Stability   : Experimental
 -- Portability : GHC
 --
+-- Functions pertaining to Computer Vision.
+--
 --------------------------------------------------------------------------------
 module ArrayFire.Vision where
 
