diff --git a/Paths_yi.hs b/Paths_yi.hs
--- a/Paths_yi.hs
+++ b/Paths_yi.hs
@@ -8,13 +8,13 @@
 import System.Environment (getEnv)
 
 version :: Version
-version = Version {versionBranch = [0,4], versionTags = []}
+version = Version {versionBranch = [0,4,1], versionTags = []}
 
 bindir, libdir, datadir, libexecdir :: FilePath
 
 bindir     = "/home/bernardy/.cabal/bin"
-libdir     = "/home/bernardy/.cabal/lib/yi-0.4/ghc-6.8.3"
-datadir    = "/home/bernardy/.cabal/share/yi-0.4"
+libdir     = "/home/bernardy/.cabal/lib/yi-0.4.1/ghc-6.8.3"
+datadir    = "/home/bernardy/.cabal/share/yi-0.4.1"
 libexecdir = "/home/bernardy/.cabal/libexec"
 
 getBinDir, getLibDir, getDataDir, getLibexecDir :: IO FilePath
diff --git a/Yi/Buffer.hs b/Yi/Buffer.hs
--- a/Yi/Buffer.hs
+++ b/Yi/Buffer.hs
@@ -41,9 +41,6 @@
   , nelemsB
   , nelemsB'
   , writeB
-  , getfileB
-  , setfileB
-  , setnameB
   , deleteNAt
   , deleteNBytes
   , readB
@@ -59,6 +56,7 @@
   , isUnchangedB
   , isUnchangedBuffer
   , setMode
+  , modifyMode
   , regexB
   , searchB
   , readAtB
@@ -90,6 +88,8 @@
   , getMarkPointB
   , module Yi.Buffer.Basic
   , pointAt
+  , fileA
+  , nameA
   )
 where
 
@@ -149,7 +149,7 @@
                 , undos  :: !URList               -- ^ undo/redo list
                 , rawbuf :: !(BufferImpl syntax)
                 , bmode  :: !(Mode syntax)
-                , readOnly :: Bool -- ^ a read-only bit
+                , readOnly :: Bool                -- ^ a read-only bit (TODO)
                 , bufferDynamic :: !DynamicValues -- ^ dynamic components
                 , preferCol :: !(Maybe Int)       -- ^ prefered column to arrive at when we do a lineDown / lineUp
                 , pendingUpdates :: [UIUpdate]    -- ^ updates that haven't been synched in the UI yet
@@ -373,15 +373,6 @@
 markSavedB :: BufferM ()
 markSavedB = modifyA undosA setSavedFilePointU
 
-getfileB :: BufferM (Maybe FilePath)
-getfileB = gets file
-
-setfileB :: FilePath -> BufferM ()
-setfileB f = setA fileA (Just f)
-
-setnameB :: String -> BufferM ()
-setnameB = setA nameA
-
 keyB :: FBuffer -> BufferRef
 keyB (FBuffer { bkey = u }) = u
 
@@ -544,12 +535,26 @@
 setMode0 m (FBuffer f1 f2 f3 f4 rb _ f7 f8 f9 f10 f11 f12 f13) =
     (FBuffer f1 f2 f3 f4 (setSyntaxBI (modeHL m) rb) m f7 f8 f9 f10 f11 f12 f13)
 
+modifyMode0 :: (forall syntax. Mode syntax -> Mode syntax) -> FBuffer -> FBuffer
+modifyMode0 f (FBuffer f1 f2 f3 f4 rb m f7 f8 f9 f10 f11 f12 f13) =
+    let m' = f m
+    in (FBuffer f1 f2 f3 f4 (setSyntaxBI (modeHL m') rb) m' f7 f8 f9 f10 f11 f12 f13)
+
+
 -- | Set the mode
 setMode :: Mode syntax -> BufferM ()
 setMode m = do
   modify (setMode0 m)
   -- reset the keymap process so we use the one of the new mode.
   setA keymapProcessA I.End 
+
+-- | Modify the mode
+modifyMode :: (forall syntax. Mode syntax -> Mode syntax) -> BufferM ()
+modifyMode f = do
+  modify (modifyMode0 f)
+  -- reset the keymap process so we use the one of the new mode.
+  setA keymapProcessA I.End 
+
 
 withMode0 :: (forall syntax. Mode syntax -> a) -> FBuffer -> a
 withMode0 f FBuffer {bmode = m} = f m 
diff --git a/Yi/Buffer/HighLevel.hs b/Yi/Buffer/HighLevel.hs
--- a/Yi/Buffer/HighLevel.hs
+++ b/Yi/Buffer/HighLevel.hs
@@ -299,6 +299,7 @@
   moveToSol
   replicateM_ n lineUp
 
+askMarks :: BufferM WinMarks
 askMarks = do
     Just ms <- getMarks =<< ask
     return ms
diff --git a/Yi/Buffer/Region.hs b/Yi/Buffer/Region.hs
--- a/Yi/Buffer/Region.hs
+++ b/Yi/Buffer/Region.hs
@@ -17,7 +17,6 @@
   )
 where
 import Yi.Region
-import Yi.Window
 import Yi.Buffer
 import Yi.Prelude
 import Prelude ()
diff --git a/Yi/Dired.hs b/Yi/Dired.hs
--- a/Yi/Dired.hs
+++ b/Yi/Dired.hs
@@ -64,12 +64,13 @@
 import Yi.Modes (defaultFundamentalMode)
 import Yi.Keymap.Keys
 import System.FriendlyPath
+import Yi.Accessor
 
 -- | associate buffer with file
 setFileName :: BufferRef -> FilePath -> YiM ()
 setFileName b filename = do
   cfn <- liftIO $ canonicalizePath filename
-  withGivenBuffer b $ setfileB cfn
+  withGivenBuffer b $ setA fileA $ Just cfn
 
 ------------------------------------------------
 -- | If file exists, read contents of file into a new buffer, otherwise
@@ -244,7 +245,7 @@
     withBuffer $ do end <- sizeB
                     deleteRegionB (mkRegion 0 end)
     -- Write Header
-    Just dir <- withBuffer getfileB
+    Just dir <- withBuffer $ getA fileA
     withBuffer $ insertN $ dir ++ ":\n"
     p <- withBuffer pointB
     withBuffer $ addOverlayB $ mkOverlay UserLayer (mkRegion 0 (p-2)) headStyle
@@ -460,7 +461,7 @@
 
 diredLoad :: YiM ()
 diredLoad = do
-    (Just dir) <- withBuffer getfileB
+    (Just dir) <- withBuffer $ getA fileA
     (fn, de) <- fileFromPoint
     let sel = dir </> fn
     case de of
@@ -502,13 +503,13 @@
 
 diredUpDir :: YiM ()
 diredUpDir = do
-    (Just dir) <- withBuffer getfileB
+    (Just dir) <- withBuffer $ getA fileA
     diredDir $ takeDirectory dir
 
 diredCreateDir :: YiM ()
 diredCreateDir = do
     withMinibufferGen "" noHint "Create Dir:" return $ \nm -> do
-    (Just dir) <- withBuffer getfileB
+    (Just dir) <- withBuffer $ getA fileA
     let newdir = dir </> nm
     msgEditor $ "Creating "++newdir++"..."
     liftIO $ createDirectoryIfMissing True newdir
diff --git a/Yi/File.hs b/Yi/File.hs
--- a/Yi/File.hs
+++ b/Yi/File.hs
@@ -15,6 +15,7 @@
 import Control.Monad.Trans
 import Prelude hiding (error)
 import System.FilePath
+import Yi.Accessor
 import Yi.Buffer
 import Yi.Buffer.HighLevel
 import Yi.Editor
@@ -29,7 +30,7 @@
 -- | Revert to the contents of the file on disk
 revertE :: YiM ()
 revertE = do
-            mfp <- withBuffer getfileB
+            mfp <- withBuffer $ getA fileA
             case mfp of
                      Just fp -> do
                              s <- liftIO $ UTF8.readFile fp
@@ -48,7 +49,7 @@
 -- | Write a given buffer to a disk if it is associated with a file.
 fwriteBufferE :: BufferRef -> YiM ()
 fwriteBufferE bufferKey = 
-  do nameContents <- withGivenBuffer bufferKey ((,) <$> getfileB <*> streamB Forward 0)
+  do nameContents <- withGivenBuffer bufferKey ((,) <$> getA fileA <*> streamB Forward 0)
      case nameContents of
        (Just f, contents) -> do withGivenBuffer bufferKey markSavedB
                                 liftIO $ LB.writeFile f contents 
@@ -57,7 +58,7 @@
 -- | Write current buffer to disk as @f@. If this buffer doesn't
 -- currently have a file associated with it, the file is set to @f@
 fwriteToE :: String -> YiM ()
-fwriteToE f = do withBuffer $ setfileB f
+fwriteToE f = do withBuffer $ setA fileA $ Just f
                  fwriteE
 
 -- | Write all open buffers
diff --git a/Yi/Keymap/Cua.hs b/Yi/Keymap/Cua.hs
--- a/Yi/Keymap/Cua.hs
+++ b/Yi/Keymap/Cua.hs
@@ -3,7 +3,6 @@
 module Yi.Keymap.Cua (keymap) where
 
 import Prelude hiding (error)
-import Yi.Accessor
 import Yi.Buffer
 import Yi.Buffer.HighLevel
 import Yi.Buffer.Normal
diff --git a/Yi/Keymap/Emacs/Utils.hs b/Yi/Keymap/Emacs/Utils.hs
--- a/Yi/Keymap/Emacs/Utils.hs
+++ b/Yi/Keymap/Emacs/Utils.hs
@@ -67,6 +67,7 @@
 import Yi.Misc
 import Yi.Regex
 import Yi.Search
+import Yi.Accessor
 
 {- End of Module Imports -}
 
@@ -229,7 +230,7 @@
 -- | Open a file using the minibuffer. We have to set up some stuff to allow hints
 --   and auto-completion.
 findFile :: YiM ()
-findFile = do maybePath <- withBuffer getfileB
+findFile = do maybePath <- withBuffer $ getA fileA
               startPath <- addTrailingPathSeparator <$> (liftIO $ canonicalizePath' =<< getFolder maybePath)
               -- TODO: Just call withMinibuffer
               withMinibufferGen startPath (findFileHint startPath) "find file:" (simpleComplete $ matchingFileNames (Just startPath)) $ \filename -> do
diff --git a/Yi/Keymap/Vim.hs b/Yi/Keymap/Vim.hs
--- a/Yi/Keymap/Vim.hs
+++ b/Yi/Keymap/Vim.hs
@@ -7,7 +7,6 @@
 -- | Vim keymap for Yi. Emulates vim :set nocompatible
 module Yi.Keymap.Vim ( keymap, viWrite ) where
 
-import Yi.Accessor
 import Yi.Prelude
 import Prelude (maybe, length, filter, map, drop, takeWhile, dropWhile,
                 break, uncurry)
@@ -896,7 +895,7 @@
 -- Need to catch any exception to avoid losing bindings
 viWrite :: YiM ()
 viWrite = do
-    mf <- withBuffer getfileB
+    mf <- withBuffer $ getA fileA
     case mf of
         Nothing -> errorEditor "no file name associate with buffer"
         Just f  -> viWriteTo f
diff --git a/Yi/Main.hs b/Yi/Main.hs
--- a/Yi/Main.hs
+++ b/Yi/Main.hs
@@ -66,9 +66,11 @@
 import Control.Monad.Error
 import Control.Applicative
 import System.Console.GetOpt
+import System.Directory
 import System.Environment       ( getArgs )
 import System.Exit
-
+import System.FilePath
+import System.IO (readFile)
 #include "ghcconfig.h"
 
 
@@ -147,21 +149,34 @@
 
 nilKeymap :: Keymap
 nilKeymap = choice [
-             char 'c' ?>>  forever Cua.keymap,
-             char 'e' ?>>  forever Emacs.keymap,
-             char 'v' ?>>  forever Vim.keymap,
+             char 'c' ?>>  openCfg Cua.keymap,
+             char 'e' ?>>  openCfg Emacs.keymap,
+             char 'v' ?>>  openCfg Vim.keymap,
              char 'q' ?>>! quitEditor,
              char 'r' ?>>! reloadEditor,
              char 'h' ?>>! configHelp
             ] 
             <|| (anyEvent >>! errorEditor "Keymap not defined, 'q' to quit, 'h' for help.")
     where configHelp = newBufferE "*configuration help*" $ fromString $ unlines $
-                         ["To get a standard reasonable keymap, you can run yi with either --as=vim or --as=emacs.",
-                          "you can type 'c', 'e' or 'v' now to get a temporary cua, emacs or vim keymap.",
+                         ["This instance of Yi is not configured.",
+                          "To get a standard reasonable keymap, you can run yi with either --as=cua, --as=vim or --as=emacs.",
                           "You should however create your own ~/.yi/yi.hs file: ",
-                          "start by copying it from the examples directory and edit it."]
-                         -- TODO: create the default file and open it in the editor.
-
+                          "You can type 'c', 'e' or 'v' now to create and edit it using a temporary cua, emacs or vim keymap."]
+          openCfg km = write $ do
+            dataDir <- io $ getDataDir
+            let exampleCfg = dataDir </> "examples" </> "yi.hs"
+            homeDir <- io $ getHomeDirectory
+            let cfgDir = homeDir </> ".yi"
+                cfgFile = cfgDir </> "yi.hs"
+            cfgExists <- io $ doesFileExist cfgFile
+            fnewE cfgFile -- load config file
+            -- locally override the keymap to the user choice
+            withBuffer $ modifyMode (\m -> m {modeKeymap = const km})
+            when (not cfgExists) $ do
+                 -- file did not exist, load a reasonable default
+                 io $ createDirectoryIfMissing True cfgDir -- so that the file can be saved.
+                 defCfg <- io $ readFile exampleCfg
+                 withBuffer $ insertN defCfg
 
 defaultConfig :: Config
 defaultConfig = 
diff --git a/Yi/Misc.hs b/Yi/Misc.hs
--- a/Yi/Misc.hs
+++ b/Yi/Misc.hs
@@ -56,7 +56,7 @@
   withMinibufferFree "New buffer name:" strFun
   where
   strFun :: String -> YiM ()
-  strFun = withBuffer . setnameB
+  strFun = withBuffer . setA nameA
 
 ----------------------------
 -- | shell-command
@@ -123,7 +123,7 @@
 getAppropriateFiles :: Maybe String -> String -> YiM (String, [ String ])
 getAppropriateFiles start s = do
   curDir <- case start of
-            Nothing -> do bufferPath <- withBuffer getfileB
+            Nothing -> do bufferPath <- withBuffer $ getA fileA
                           liftIO $ getFolder bufferPath
             (Just path) -> return path
   let sDir = if hasTrailingPathSeparator s then s else takeDirectory s
diff --git a/Yi/Prelude.hs b/Yi/Prelude.hs
--- a/Yi/Prelude.hs
+++ b/Yi/Prelude.hs
@@ -41,6 +41,7 @@
 module Data.Int,
 module Data.Traversable,
 module Text.Show,
+module Yi.Accessor,
 module Yi.Debug,
 null,
 print,
@@ -59,6 +60,7 @@
     ) where
 
 import Yi.Debug
+import Yi.Accessor
 import Text.Show
 import Data.Bool
 import Data.Foldable
diff --git a/Yi/Search.hs b/Yi/Search.hs
--- a/Yi/Search.hs
+++ b/Yi/Search.hs
@@ -40,7 +40,6 @@
                  ) where
 
 import Prelude ()
-import Yi.Accessor
 import Yi.Prelude
 import Yi.Buffer
 import Yi.Buffer.Normal
diff --git a/examples/yi.hs b/examples/yi.hs
new file mode 100644
--- /dev/null
+++ b/examples/yi.hs
@@ -0,0 +1,34 @@
+import Yi
+import Yi.Keymap.Emacs (keymap)
+-- You can use other keymap by importing some other module:
+-- import  Yi.Keymap.Cua (keymap)
+
+-- If configured with ghcAPI, Shim Mode can be enabled:
+-- import qualified Yi.Mode.Shim as Shim
+import Yi.Mode.Haskell
+import Data.List (isSuffixOf)
+import Yi.Prelude
+import Prelude ()
+import Yi.Keymap.Keys
+
+myModetable :: ReaderT String Maybe AnyMode
+myModetable = ReaderT $ \fname -> case () of 
+                        _ | ".hs" `isSuffixOf` fname -> Just $ AnyMode bestHaskellMode
+                        _ ->  Nothing
+    where bestHaskellMode = cleverHaskellMode 
+                            {
+                             -- example of Mode-local rebinding
+                             modeKeymap = ((ctrl (char 'c') ?>> ctrl(char 'c') ?>>! haskellToggleCommentSelectionB)
+                                           <||)  
+                              -- uncomment this for Shim (dot is important!)
+                              -- . modeKeymap Shim.mode
+                            }
+
+
+main :: IO ()
+main = yi $ defaultConfig {
+                           configKillringAccumulate = True,
+                           modeTable = myModetable <|> modeTable defaultConfig,
+                           configUI = (configUI defaultConfig) { configFontSize = Just 10 },
+                           defaultKm = keymap
+                          }
diff --git a/yi.cabal b/yi.cabal
--- a/yi.cabal
+++ b/yi.cabal
@@ -1,5 +1,5 @@
 name:           yi
-version:        0.4
+version:        0.4.1
 category:       Editor
 synopsis:       The Haskell-Scriptable Editor
 description:
@@ -11,7 +11,7 @@
 maintainer:     yi-devel@googlegroups.com
 homepage:       http://haskell.org/haskellwiki/Yi
 
-cabal-Version:  >= 1.4
+Cabal-Version:  >= 1.4
 tested-with:    GHC==6.8.3
 build-type:     Simple
 data-files:
@@ -32,6 +32,7 @@
   art/license-file.png
   art/setup-script.png
   art/setup-script.png
+  examples/yi.hs
 extra-source-files: Yi/Lexer/alex.hsinc
 
 flag ghcAPI
@@ -184,7 +185,7 @@
         build-depends: regex-base ==0.93.1
         build-depends: regex-tdfa ==0.94
         
-        build-depends: parsec >=2.1
+        build-depends: parsec >=2.1 && <2.2
 
         ghc-options:   -Wall -optl-Wl,-s -threaded
 -- ghc-options later on get appended to the original
