diff --git a/Data/Number/MPFR/Arithmetic.hs b/Data/Number/MPFR/Arithmetic.hs
--- a/Data/Number/MPFR/Arithmetic.hs
+++ b/Data/Number/MPFR/Arithmetic.hs
@@ -191,13 +191,8 @@
       
 wpoww_          :: RoundMode -> Precision -> Word -> Word -> (MPFR , Int)
 wpoww_ r p d1 d2 = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do 
-                    r2 <- mpfr_ui_pow_ui p1 (fromIntegral d1) (fromIntegral d2) ((fromIntegral . fromEnum) r)
-                    r1 <- peekP p1 fp
-                    return (r1, fromIntegral r2)
+    where go = do withDummy p $ \p1 -> do 
+                    mpfr_ui_pow_ui p1 (fromIntegral d1) (fromIntegral d2) ((fromIntegral . fromEnum) r)
         
 wpow_           :: RoundMode -> Precision -> Word -> MPFR -> (MPFR , Int)
 wpow_ r p d1 d2 = withMPFRBAiu r p (fromIntegral d1) d2 mpfr_ui_pow
diff --git a/Data/Number/MPFR/Assignment.hs b/Data/Number/MPFR/Assignment.hs
--- a/Data/Number/MPFR/Assignment.hs
+++ b/Data/Number/MPFR/Assignment.hs
@@ -26,14 +26,9 @@
 
 set_         :: RoundMode -> Precision -> MPFR -> (MPFR, Int)
 set_ r p mp1 = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do
+    where go = do withDummy p $ \p1 -> do
                     with mp1 $ \p2 -> do 
-                      r2 <- mpfr_set p1 p2 ((fromIntegral . fromEnum) r) 
-                      r1 <- peekP p1 fp
-                      return (r1, fromIntegral r2)
+                      mpfr_set p1 p2 ((fromIntegral . fromEnum) r) 
 
 fromWord       :: RoundMode -> Precision -> Word -> MPFR
 fromWord r p d = fst $ fromWord_ r p d
@@ -46,34 +41,19 @@
 
 fromWord_       :: RoundMode -> Precision -> Word -> (MPFR, Int)
 fromWord_ r p d = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do 
-                    r2 <- mpfr_set_ui p1 (fromIntegral d) ((fromIntegral . fromEnum) r)
-                    r1 <- peekP p1 fp
-                    return (r1, fromIntegral r2)                
+    where go = do withDummy p $ \p1 -> do 
+                    mpfr_set_ui p1 (fromIntegral d) ((fromIntegral . fromEnum) r)
 
 fromInt_       :: RoundMode -> Precision -> Int -> (MPFR, Int)
 fromInt_ r p d = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do 
-                    r2 <- mpfr_set_si p1 (fromIntegral d) ((fromIntegral . fromEnum) r)
-                    r1 <- peekP p1 fp
-                    return (r1, fromIntegral r2)
-
+    where go = do withDummy p $ \p1 -> do
+                    mpfr_set_si p1 (fromIntegral d) ((fromIntegral . fromEnum) r)
+                    
 fromDouble_       :: RoundMode -> Precision -> Double -> (MPFR, Int)
 fromDouble_ r p d = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do 
-                    r2 <- mpfr_set_d p1 (realToFrac d) ((fromIntegral . fromEnum) r)
-                    r1 <- peekP p1 fp
-                    return (r1, fromIntegral r2)
-  
+    where go = do withDummy p $ \p1 -> do 
+                    mpfr_set_d p1 (realToFrac d) ((fromIntegral . fromEnum) r)
+                      
 -- x * 2 ^ y
 int2w         :: RoundMode -> Precision -> Word -> Int -> MPFR
 int2w r p i e = fst $ int2w_ r p i e
@@ -83,25 +63,14 @@
 
 int2w_         :: RoundMode -> Precision -> Word -> Int -> (MPFR, Int)
 int2w_ r p i e = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do
-                    r2 <- mpfr_set_ui_2exp p1 (fromIntegral i) (fromIntegral e) ((fromIntegral . fromEnum) r)
-                    r1 <- peekP p1 fp
-                    return (r1, fromIntegral r2)
-
+    where go = do withDummy p $ \p1 -> do
+                    mpfr_set_ui_2exp p1 (fromIntegral i) (fromIntegral e) ((fromIntegral . fromEnum) r)
+                    
 int2i_         :: RoundMode -> Precision -> Int -> Int -> (MPFR, Int)
 int2i_ r p i e = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do
-                    r2 <- mpfr_set_si_2exp p1 (fromIntegral i) (fromIntegral e) ((fromIntegral . fromEnum) r)
-                    r1 <- peekP p1 fp
-                    return (r1, fromIntegral r2)
-
-
+    where go = do withDummy p $ \p1 -> do
+                    mpfr_set_si_2exp p1 (fromIntegral i) (fromIntegral e) ((fromIntegral . fromEnum) r)
+                    
 stringToMPFR         :: RoundMode -> Precision 
                        -> Word -- ^ Base 
                        -> String -> MPFR
@@ -111,14 +80,9 @@
                        -> Word -- ^ Base 
                        -> String -> (MPFR, Int)
 stringToMPFR_ r p b d = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do 
+    where go = do withDummy p $ \p1 -> do 
                     withCString d $ \p2 -> do 
-                      r2 <- mpfr_set_str p1 p2 (fromIntegral b) ((fromIntegral . fromEnum) r) 
-                      r1 <- peekP p1 fp
-                      return (r1, fromIntegral r2)
+                      mpfr_set_str p1 p2 (fromIntegral b) ((fromIntegral . fromEnum) r) 
 
 strtofr         :: RoundMode -> Precision
                 -> Word -- ^ base
@@ -132,8 +96,8 @@
 strtofr_ r p b d = unsafePerformIO go
     where go = do ls <- mpfr_custom_get_size (fromIntegral p)
                   fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do 
+                  alloca $ \p1 -> do 
+                    pokeDummy p1 fp p
                     withCString d $ \p2 -> do
                       alloca $ \p3 -> do
                         r3 <- mpfr_strtofr p1 p2 p3 (fromIntegral b) ((fromIntegral . fromEnum) r)
@@ -147,8 +111,8 @@
 setInf p i = unsafePerformIO go
     where go = do ls <- mpfr_custom_get_size (fromIntegral p)
                   fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do 
+                  alloca $ \p1 -> do 
+                    pokeDummy p1 fp p
                     mpfr_set_inf p1 (fromIntegral  i)
                     peekP p1 fp
 
@@ -156,8 +120,8 @@
 setNaN p = unsafePerformIO go
     where go = do ls <- mpfr_custom_get_size (fromIntegral p)
                   fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do 
+                  alloca $ \p1 -> do 
+                    pokeDummy p1 fp p
                     mpfr_set_nan p1
                     peekP p1 fp
 
diff --git a/Data/Number/MPFR/FFIhelper.hsc b/Data/Number/MPFR/FFIhelper.hsc
--- a/Data/Number/MPFR/FFIhelper.hsc
+++ b/Data/Number/MPFR/FFIhelper.hsc
@@ -11,9 +11,9 @@
 import Foreign.C.String(CString)
 import Foreign.C.Types(CULong, CLong, CInt, CUInt, CDouble, CChar)
 import Foreign.Ptr(FunPtr, Ptr)
-
+import Foreign.Marshal(alloca)
 import Foreign.Storable
-import Foreign.ForeignPtr (ForeignPtr, withForeignPtr)
+import Foreign.ForeignPtr (ForeignPtr, withForeignPtr, mallocForeignPtrBytes)
 
 import Data.Typeable(Typeable)
 
@@ -50,12 +50,30 @@
                                  #{poke __mpfr_struct, _mpfr_sign} p s 
                                  #{poke __mpfr_struct, _mpfr_exp} p e
                                  withForeignPtr fp $ \p1 -> #{poke __mpfr_struct, _mpfr_d} p p1
-
+{-# INLINE peekP #-}
 peekP      :: Ptr MPFR -> ForeignPtr Limb -> IO MPFR
 peekP p fp = do r11 <- #{peek __mpfr_struct, _mpfr_prec} p
 	        r21 <- #{peek __mpfr_struct, _mpfr_sign} p
 		r22 <- #{peek __mpfr_struct, _mpfr_exp} p
                 return (MP r11 r21 r22 fp)
+{-# INLINE withDummy #-}
+withDummy     :: Word -> (Ptr MPFR -> IO CInt) -> IO (MPFR, Int)
+withDummy w f = do alloca $ \ptr -> do
+                      ls <- mpfr_custom_get_size (fromIntegral w)
+                      fp <- mallocForeignPtrBytes (fromIntegral ls)
+                      #{poke __mpfr_struct, _mpfr_prec} ptr (fromIntegral w :: CPrecision)
+                      #{poke __mpfr_struct, _mpfr_sign} ptr (1 :: Sign) 
+                      #{poke __mpfr_struct, _mpfr_exp} ptr (0 :: Exp)
+                      withForeignPtr fp $ \p1 -> #{poke __mpfr_struct, _mpfr_d} ptr p1
+                      r2 <- f ptr
+                      r1 <- peekP ptr fp
+                      return (r1, fromIntegral r2)
+
+pokeDummy          :: Ptr MPFR -> ForeignPtr Limb -> Word -> IO ()
+pokeDummy ptr fp p = do #{poke __mpfr_struct, _mpfr_prec} ptr (fromIntegral p :: CPrecision)
+                        #{poke __mpfr_struct, _mpfr_sign} ptr (0 :: Sign) 
+                        #{poke __mpfr_struct, _mpfr_exp} ptr (0 :: Exp)
+                        withForeignPtr fp $ \p1 -> #{poke __mpfr_struct, _mpfr_d} ptr p1
 
 bitsPerMPLimb :: Int 
 bitsPerMPLimb = 8 * #size mp_limb_t
diff --git a/Data/Number/MPFR/Integer.hs b/Data/Number/MPFR/Integer.hs
--- a/Data/Number/MPFR/Integer.hs
+++ b/Data/Number/MPFR/Integer.hs
@@ -92,8 +92,8 @@
 remquo_ r p d d' = unsafePerformIO go
     where go = do ls <- mpfr_custom_get_size (fromIntegral p)
                   fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do 
+                  alloca $ \p1 -> do
+                    pokeDummy p1 fp p
                     with d $ \p2 -> do
                       with d' $ \p3 -> do
                         alloca $ \p4 -> do
diff --git a/Data/Number/MPFR/Internal.hs b/Data/Number/MPFR/Internal.hs
--- a/Data/Number/MPFR/Internal.hs
+++ b/Data/Number/MPFR/Internal.hs
@@ -34,147 +34,105 @@
                                -> (Ptr MPFR -> Ptr MPFR -> Ptr MPFR -> CRoundMode -> IO CInt)
                                -> (MPFR, Int)
 withMPFRsBA r p !mp1 !mp2 f = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $! \p1 -> do
-                    with mp1 $! \p2 -> do
-                      with mp2 $! \p3 -> do
-                          r2 <- f p1 p2 p3 ((fromIntegral . fromEnum) r)
-                          r1 <- peekP p1 fp
-                          return (r1, fromIntegral r2)
+    where go = do withDummy p $ \p1 -> do
+                    with mp1 $ \p2 -> do
+                      with mp2 $ \p3 -> do
+                          f p1 p2 p3 ((fromIntegral . fromEnum) r)
+                          
 
 {-# INLINE withMPFRBAui #-}
 withMPFRBAui :: RoundMode -> Precision -> MPFR -> CULong
                   ->  (Ptr MPFR -> Ptr MPFR -> CULong -> CRoundMode -> IO CInt)
                   -> (MPFR, Int) 
 withMPFRBAui r p !mp1 d f = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $! \p1 -> do
-                    with mp1 $! \p2 -> do
-                      r2 <- f p1 p2 d ((fromIntegral . fromEnum) r)
-                      r1 <- peekP p1 fp
-                      return (r1, fromIntegral r2)
+    where go = do withDummy p $ \p1 -> do
+                    with mp1 $ \p2 -> do
+                      f p1 p2 d ((fromIntegral . fromEnum) r)
                                 
 {-# INLINE withMPFRBAsi #-}
 withMPFRBAsi             :: RoundMode -> Precision -> MPFR -> CLong
                               -> (Ptr MPFR -> Ptr MPFR -> CLong -> CRoundMode -> IO CInt)
                               -> (MPFR, Int)
 withMPFRBAsi r p !mp1 d f = unsafePerformIO go 
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $! \p1 -> do
-                    with mp1 $! \p2 -> do
-                      r2 <- f p1 p2 d ((fromIntegral . fromEnum) r)
-                      r1 <- peekP p1 fp
-                      return (r1, fromIntegral r2)
+    where go = do withDummy p $ \p1 -> do
+                    with mp1 $ \p2 -> do
+                      f p1 p2 d ((fromIntegral . fromEnum) r)
                                   
 {-# INLINE withMPFRBAiu #-}
 withMPFRBAiu             :: RoundMode -> Precision -> CULong -> MPFR
                               -> (Ptr MPFR -> CULong -> Ptr MPFR -> CRoundMode -> IO CInt)
                               -> (MPFR, Int) 
 withMPFRBAiu r p d !mp1 f = unsafePerformIO go 
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $! \p1 -> do
-                    with mp1 $! \p2 -> do
-                      r2 <- f p1 d p2 ((fromIntegral . fromEnum) r)
-                      r1 <- peekP p1 fp
-                      return (r1, fromIntegral r2)
-
+    where go = do withDummy p $ \p1 -> do
+                    with mp1 $ \p2 -> do
+                      f p1 d p2 ((fromIntegral . fromEnum) r)
+                      
 {-# INLINE withMPFRBAis #-}
 withMPFRBAis             :: RoundMode -> Precision -> CLong -> MPFR
                               -> (Ptr MPFR -> CLong -> Ptr MPFR -> CRoundMode -> IO CInt)
                               -> (MPFR, Int) 
 withMPFRBAis r p d !mp1 f = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $! \p1 -> do
-                    with mp1 $! \p2 -> do
-                      r2 <- f p1 d p2 ((fromIntegral . fromEnum) r)
-                      r1 <- peekP p1 fp
-                      return (r1, fromIntegral r2)
-
+    where go = do withDummy p $ \p1 -> do
+                    with mp1 $ \p2 -> do
+                      f p1 d p2 ((fromIntegral . fromEnum) r)
+                     
 {-# INLINE withMPFRB #-}
 withMPFRB       :: MPFR -> (Ptr MPFR -> IO CInt) -> CInt 
 withMPFRB mp1 !f = unsafePerformIO go
-    where go = with mp1 $! \p1 -> f p1
+    where go = with mp1 $ \p1 -> f p1
 
 withMPFRP       :: MPFR -> (Ptr MPFR -> IO CPrecision) -> CPrecision 
 withMPFRP mp1 !f = unsafePerformIO go
-    where go = with mp1 $! \p1 -> f p1
+    where go = with mp1 $ \p1 -> f p1
 
 {-# INLINE withMPFR #-}
 withMPFR           :: RoundMode -> Precision -> MPFR 
                         -> (Ptr MPFR -> Ptr MPFR -> CRoundMode -> IO CInt) 
                         -> (MPFR, Int)
 withMPFR r p !mp1 f = unsafePerformIO go 
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $! \p1 -> do
-                    with mp1 $! \p2 -> do
-                      r2 <- f p1 p2 ((fromIntegral . fromEnum) r)
-                      r1 <- peekP p1 fp
-                      return (r1, fromIntegral r2)
-                  
+    where go = do withDummy p $ \p1 -> do
+                    with mp1 $ \p2 -> do
+                      f p1 p2 ((fromIntegral . fromEnum) r)
+                      
 {-# INLINE withMPFRBB #-}
 withMPFRBB           :: MPFR -> MPFR 
                           -> (Ptr MPFR -> Ptr MPFR -> IO CInt) 
                           -> CInt  
 withMPFRBB mp1 mp2 f = unsafePerformIO go
-    where go = do with mp1 $! \p1 -> do 
-                    with mp2 $! \p2 -> do 
+    where go = do with mp1 $ \p1 -> do 
+                    with mp2 $ \p2 -> do 
                                       f p1 p2
                               
 {-# INLINE withMPFRC #-}
 withMPFRC       :: RoundMode -> Precision ->
                      (Ptr MPFR -> CRoundMode -> IO CInt) -> (MPFR, Int)
 withMPFRC r p f = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $! \p1 -> do
-                    r2 <- f p1 ((fromIntegral . fromEnum) r)
-                    r1 <- peekP p1 fp
-                    return (r1, fromIntegral r2)
+    where go = do withDummy p $ \p1 -> do
+                    f p1 ((fromIntegral . fromEnum) r)
    
 withMPFRF         :: MPFR -> RoundMode
                        -> (Ptr MPFR -> CRoundMode -> IO CInt)
                        -> Int
 withMPFRF !mp1 r f = (fromIntegral . unsafePerformIO) go
-    where go = do with mp1 $! \p1 -> f p1 ((fromIntegral . fromEnum) r)
+    where go = do with mp1 $ \p1 -> f p1 ((fromIntegral . fromEnum) r)
 
 {-# INLINE withMPFRUI #-}
 withMPFRUI         :: RoundMode -> Precision -> Word
                         -> (Ptr MPFR -> CULong -> CRoundMode -> IO CInt)
                         -> (MPFR, Int)
 withMPFRUI r p d f = unsafePerformIO go 
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $! \p1 -> do
-                    r2 <- f p1 (fromIntegral d) ((fromIntegral . fromEnum) r)
-                    r1 <- peekP p1 fp
-                    return (r1, fromIntegral r2)
+    where go = do withDummy p $ \p1 -> do
+                    f p1 (fromIntegral d) ((fromIntegral . fromEnum) r)
+                    
 {-# INLINE withMPFRR #-}
 withMPFRR       :: Precision -> MPFR
                      -> (Ptr MPFR -> Ptr MPFR -> IO CInt)
                      -> (MPFR, Int)
 withMPFRR p d f = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $! \p1 -> do
-                    with d $! \p2 -> do
-                      r2 <- f p1 p2
-                      r1 <- peekP p1 fp
-                      return (r1, fromIntegral r2)
+    where go = do withDummy p $ \p1 -> do
+                    with d $ \p2 -> do
+                      f p1 p2
+
                         
 
 checkPrec :: Precision -> Precision
@@ -182,7 +140,7 @@
 
 getMantissa'     :: MPFR -> [Limb]
 getMantissa' (MP p _ _ p1) = unsafePerformIO go
-    where go = do withForeignPtr p1 $! \pt -> do 
+    where go = do withForeignPtr p1 $ \pt -> do 
                     arr <- peekArray (Prelude.ceiling ((fromIntegral p ::Double) / fromIntegral bitsPerMPLimb)) pt ;
                     return arr 
 
diff --git a/Data/Number/MPFR/Misc.hs b/Data/Number/MPFR/Misc.hs
--- a/Data/Number/MPFR/Misc.hs
+++ b/Data/Number/MPFR/Misc.hs
@@ -22,11 +22,11 @@
 
 nextToward         :: MPFR -> MPFR -> MPFR
 nextToward mp1 mp2 = unsafePerformIO go
-    where go = do let p = fromIntegral (getPrec mp1)
-                  ls <- mpfr_custom_get_size p
+    where go = do let p = getPrec mp1
+                  ls <- mpfr_custom_get_size (fromIntegral p)
                   fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP p 0 0 fp
-                  with dummy $ \p1 -> do
+                  alloca $ \p1 -> do
+                      pokeDummy p1 fp p
                       with mp1 $ \p2 -> do 
                         with mp2 $ \p3 -> do
                           _ <- mpfr_set p1 p2 ((fromIntegral . fromEnum) Near) 
@@ -36,11 +36,11 @@
 
 nextAbove     :: MPFR -> MPFR
 nextAbove mp1 = unsafePerformIO go
-    where go = do let p = fromIntegral (getPrec mp1)
-                  ls <- mpfr_custom_get_size p
+    where go = do let p = getPrec mp1
+                  ls <- mpfr_custom_get_size (fromIntegral p)
                   fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP p 0 0 fp
-                  with dummy $ \p1 -> do
+                  alloca $ \p1 -> do
+                      pokeDummy p1 fp p
                       with mp1 $ \p2 -> do 
                         _ <- mpfr_set p1 p2 ((fromIntegral . fromEnum) Near) 
                         mpfr_nextabove p1 
@@ -48,11 +48,11 @@
 
 nextBelow     :: MPFR -> MPFR
 nextBelow mp1 = unsafePerformIO go
-    where go = do let p = fromIntegral (getPrec mp1)
-                  ls <- mpfr_custom_get_size p
+    where go = do let p = getPrec mp1
+                  ls <- mpfr_custom_get_size (fromIntegral p)
                   fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP p 0 0 fp
-                  with dummy $ \p1 -> do
+                  alloca $ \p1 -> do
+                      pokeDummy p1 fp p
                       with mp1 $ \p2 -> do 
                         _ <- mpfr_set p1 p2 ((fromIntegral . fromEnum) Near) 
                         mpfr_nextbelow p1 
@@ -67,8 +67,8 @@
 random2       :: Precision -> MpSize -> Exp -> IO MPFR
 random2 p m e = do ls <- mpfr_custom_get_size (fromIntegral p)
                    fp <- mallocForeignPtrBytes (fromIntegral ls)
-                   let dummy = MP (fromIntegral p) 0 0 fp
-                   with dummy $ \p1 -> do
+                   alloca $ \p1 -> do
+                     pokeDummy p1 fp p
                      mpfr_random2 p1 m e
                      peekP p1 fp
 
@@ -78,11 +78,11 @@
 
 setExp     :: MPFR -> Exp -> MPFR
 setExp d e = unsafePerformIO go
-    where go = do let p = fromIntegral (getPrec d)
-                  ls <- mpfr_custom_get_size p
+    where go = do let p = getPrec d
+                  ls <- mpfr_custom_get_size (fromIntegral p)
                   fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP p 0 0 fp
-                  with dummy $ \p1 -> do
+                  alloca $ \p1 -> do
+                    pokeDummy p1 fp p
                     with d $ \p2 -> do 
                       mpfr_set p1 p2 ((fromIntegral . fromEnum) Near)
                       mpfr_set_exp p1 e
diff --git a/Data/Number/MPFR/Special.hs b/Data/Number/MPFR/Special.hs
--- a/Data/Number/MPFR/Special.hs
+++ b/Data/Number/MPFR/Special.hs
@@ -222,12 +222,12 @@
 sincos_ r p p' d = unsafePerformIO go 
     where go = do ls <- mpfr_custom_get_size (fromIntegral p)
                   fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
                   ls' <- mpfr_custom_get_size (fromIntegral p')
                   fp' <- mallocForeignPtrBytes (fromIntegral ls')
-                  let dummy' = MP (fromIntegral p') 0 0 fp'
-                  with dummy $ \p1 -> do 
-                    with dummy' $ \p2 -> do 
+                  alloca $ \p1 -> do 
+                    pokeDummy p1 fp (fromIntegral ls)
+                    alloca $ \p2 -> do 
+                      pokeDummy p2 fp' (fromIntegral ls')
                       with d $ \p3 -> do
                         r3 <- mpfr_sin_cos p1 p2 p3 ((fromIntegral . fromEnum) r)
                         r1 <- peekP p1 fp
@@ -295,8 +295,8 @@
 lgamma_ r p d = unsafePerformIO go
     where go = do ls <- mpfr_custom_get_size (fromIntegral p)
                   fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do
+                  alloca $ \p1 -> do
+                    pokeDummy p1 fp (fromIntegral ls)
                     with d $ \p2 -> do
                       alloca $ \p3 -> do
                         r3 <- mpfr_lgamma p1 p3 p2 ((fromIntegral . fromEnum) r)
@@ -336,29 +336,19 @@
 
 fma_                 :: RoundMode -> Precision -> MPFR -> MPFR -> MPFR -> (MPFR, Int)
 fma_ r p mp1 mp2 mp3 = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do
+    where go = do withDummy p $ \p1 -> do
                     with mp1 $ \p2 -> do 
                       with mp2 $ \p3 -> do 
                         with mp3 $ \p4 -> do 
-                          r2 <- mpfr_fma p1 p2 p3 p4 ((fromIntegral . fromEnum) r) 
-                          r1 <- peekP p1 fp 
-                          return (r1, fromIntegral r2)
+                          mpfr_fma p1 p2 p3 p4 ((fromIntegral . fromEnum) r) 
 
 fms_                 :: RoundMode -> Precision -> MPFR -> MPFR -> MPFR -> (MPFR, Int)
 fms_ r p mp1 mp2 mp3 = unsafePerformIO go
-    where go = do ls <- mpfr_custom_get_size (fromIntegral p)
-                  fp <- mallocForeignPtrBytes (fromIntegral ls)
-                  let dummy = MP (fromIntegral p) 0 0 fp
-                  with dummy $ \p1 -> do
+    where go = do withDummy p $ \p1 -> do
                     with mp1 $ \p2 -> do 
                       with mp2 $ \p3 -> do 
                         with mp3 $ \p4 -> do 
-                          r2 <- mpfr_fms p1 p2 p3 p4 ((fromIntegral . fromEnum) r) 
-                          r1 <- peekP p1 fp
-                          return (r1, fromIntegral r2)
+                          mpfr_fms p1 p2 p3 p4 ((fromIntegral . fromEnum) r) 
 
 agm_           :: RoundMode -> Precision -> MPFR -> MPFR -> (MPFR,Int)
 agm_ r p d1 d2 =  withMPFRsBA r p d1 d2 mpfr_agm
diff --git a/hmpfr.cabal b/hmpfr.cabal
--- a/hmpfr.cabal
+++ b/hmpfr.cabal
@@ -1,5 +1,5 @@
 name:                hmpfr
-version:             0.1
+version:             0.1.1
 synopsis:            Haskell binding to MPFR library
 description:         Haskell binding to MPFR library. Tested with MPFR 2.3.1 and 2.3.2.
 		     Some simple examples of usage can be found in test/Demo.hs.
@@ -39,7 +39,7 @@
 
 build-type:          Simple
 build-tools:         hsc2hs
-GHC-options:         -Wall -fno-warn-orphans -O2
+GHC-options:         -Wall -fno-warn-orphans -O2 -fvia-C -optc-O2
 GHC-prof-options:    -prof -auto-all
 include-dirs:        cbits
 includes:            chsmpfr.h mpfr.h
