 
 {# enum GDALRWFlag as RwFlag {upcaseFirstLetter} deriving (Eq, Show) #}
 
-{#pointer GDALMajorObjectH as MajorObject newtype#}
 {#pointer GDALDatasetH as Dataset foreign newtype nocode#}
 
 data ReadOnly
 data ReadWrite
 newtype Dataset a t = Dataset (ForeignPtr (Dataset a t), Mutex)
 
+unDataset :: Dataset a t -> ForeignPtr (Dataset a t)
 unDataset (Dataset (d, _)) = d
 
 type RODataset = Dataset ReadOnly
 type RWDataset = Dataset ReadWrite
-withDataset, withDataset' :: (Dataset a t) -> (Ptr (Dataset a t) -> IO b) -> IO b
-withDataset ds@(Dataset (_, m)) fun = withMutex m $ withDataset' ds fun
-
-withDataset' (Dataset (fptr,_)) = withForeignPtr fptr
+
+withDataset :: (Dataset a t) -> (Ptr (Dataset a t) -> IO b) -> IO b
+withDataset (Dataset (fptr,_)) = withForeignPtr fptr
 
 {#pointer GDALRasterBandH as Band newtype nocode#}
-newtype (Band s a t) = Band (Ptr ((Band s a t)))
-
+newtype (Band s a t) = Band (Ptr (Band s a t))
+
+unBand :: Band s a t -> Ptr (Band s a t)
 unBand (Band b) = b
 
 type ROBand s = Band s ReadOnly

    deriving (Eq, Show)

datasetGeotransform :: Dataset a t -> IO Geotransform
datasetGeotransform ds = withDataset' ds $ \dPtr -> do
    allocaArray 6 $ \a -> do
      throwIfError "could not get geotransform" $ getGeoTransform dPtr a
      Geotransform <$> liftM realToFrac (peekElemOff a 0)

  , Geotransform (..)
  , IOVector
  , DriverOptions
  , Dataset
  , ReadWrite
  , ReadOnly
