diff --git a/Data/ASN1/Internal.hs b/Data/ASN1/Internal.hs
--- a/Data/ASN1/Internal.hs
+++ b/Data/ASN1/Internal.hs
@@ -34,12 +34,11 @@
 {- | bytesOfInt convert an integer into a two's completemented list of bytes -}
 bytesOfInt :: Integer -> [Word8]
 bytesOfInt i
-	| i > 0      = ints
+	| i > 0      = if testBit (head uints) 7 then 0 : uints else uints
 	| i == 0     = [0]
-	| otherwise  = reverse $ plusOne $ reverse $ map complement $ ints
+	| otherwise  = if testBit (head nints) 7 then nints else 0xff : nints
 	where
 		uints = bytesOfUInt (abs i)
-		isNeg = testBit (head uints) 7
-		ints  = if isNeg then 0 : uints else uints
-		plusOne []     = []
+		nints = reverse $ plusOne $ reverse $ map complement $ uints
+		plusOne []     = [1]
 		plusOne (x:xs) = if x == 0xff then 0 : plusOne xs else (x+1) : xs
diff --git a/Data/ASN1/Prim.hs b/Data/ASN1/Prim.hs
--- a/Data/ASN1/Prim.hs
+++ b/Data/ASN1/Prim.hs
@@ -266,7 +266,7 @@
 putString :: L.ByteString -> ValStruct
 putString l = Primitive $ B.concat $ L.toChunks l
 
-{- no enforce check that we oid1 is between [0..2] and oid2 is between [0..39] -}
+{- no enforce check that oid1 is between [0..2] and oid2 is between [0..39] -}
 putOID :: [Integer] -> ValStruct
 putOID oids = Primitive $ B.pack $ eoid
 	where
diff --git a/Data/ASN1/Raw.hs b/Data/ASN1/Raw.hs
--- a/Data/ASN1/Raw.hs
+++ b/Data/ASN1/Raw.hs
@@ -165,28 +165,27 @@
 getLength = do
 	l1 <- geteWord8
 	if testBit l1 7
-		then
-			case fromIntegral (clearBit l1 7) of
-				0   -> return LenIndefinite
-				len -> do
-					lw <- geteBytes len
-					return $ LenLong len (fromIntegral $ snd $ uintOfBytes lw)
+		then case fromIntegral (clearBit l1 7) of
+			0   -> return LenIndefinite
+			len -> do
+				lw <- geteBytes len
+				return $ LenLong len (fromIntegral $ snd $ uintOfBytes lw)
 		else
 			return $ LenShort $ fromIntegral l1
 
 {- | putLength encode a length into a ASN1 length.
  - see getLength for the encoding rules -}
 putLength :: ValLength -> Put
-putLength (LenShort i) = do
-	when (i < 0 || i > 0x7f) (error "putLength: short length is not between 0x0 and 0x80")
-	putWord8 (fromIntegral i)
+putLength (LenShort i)
+	| i < 0 || i > 0x7f = error "putLength: short length is not between 0x0 and 0x80"
+	| otherwise         = putWord8 $ fromIntegral i
 
-putLength (LenLong _ i) = do
-	when (i < 0) (error "putLength: long length is negative")
-	let lw = bytesOfUInt $ fromIntegral i
-	let lenbytes = fromIntegral (length lw .|. 0x80)
-	putWord8 lenbytes
-	mapM_ putWord8 lw
+putLength (LenLong _ i)
+	| i < 0     = error "putLength: long length is negative"
+	| otherwise = putWord8 lenbytes >> mapM_ putWord8 lw
+		where
+			lw       = bytesOfUInt $ fromIntegral i
+			lenbytes = fromIntegral (length lw .|. 0x80)
 	
 putLength (LenIndefinite) = putWord8 0x80
 
@@ -195,12 +194,8 @@
 getValueConstructed check = do
 	remain <- liftGet remaining
 	if remain > 0
-		then do
-			o <- getValueCheck check
-			l <- getValueConstructed check
-			return (o : l)
-		else
-			return []
+		then liftM2 (:) (getValueCheck check) (getValueConstructed check)
+		else return []
 
 {- helper to getValue to build a constructed list of values when length is unknown -}
 getValueConstructedUntilEOC :: CheckFn -> GetErr [Value]
@@ -209,18 +204,15 @@
 	case o of
 		-- technically EOC should also match (Primitive B.empty) (LenShort 0)
 		Value Universal 0 _ -> return []
-		_                   -> do
-			l <- getValueConstructedUntilEOC check
-			return (o : l)
+		_                   -> liftM (o :) (getValueConstructedUntilEOC check)
 
 getValueOfLength :: CheckFn -> Int -> Bool -> GetErr ValStruct
 getValueOfLength check len pc = do
 	b <- geteBytes len
 	if pc
-		then
-			case runGetErr (getValueConstructed check) (L.fromChunks [b]) of
-				Right x  -> return $ Constructed x
-				Left err -> throwError err
+		then case runGetErr (getValueConstructed check) (L.fromChunks [b]) of
+			Right x  -> return $ Constructed x
+			Left err -> throwError err
 		else
 			return $ Primitive b
 
diff --git a/Tests.hs b/Tests.hs
--- a/Tests.hs
+++ b/Tests.hs
@@ -52,7 +52,7 @@
 	arbitrary = liftM3 Value arbitrary (suchThat arbitrary (\i -> i > 0)) arbitrary
 
 arbitraryTime = do
-	y <- choose (1950, 2050)
+	y <- choose (1951, 2050)
 	m <- choose (0, 11)
 	d <- choose (0, 31)
 	h <- choose (0, 23)
diff --git a/asn1-data.cabal b/asn1-data.cabal
--- a/asn1-data.cabal
+++ b/asn1-data.cabal
@@ -1,17 +1,18 @@
 Name:                asn1-data
-Version:             0.2
+Version:             0.2.1
 Description:
-    ASN1 data reader/writer in raw form with supports for high level forms of ASN1 (BER/CER/DER)
+    ASN1 data reader and writer in raw form with supports for high level forms of ASN1 (BER, CER and DER)
 License:             BSD3
 License-file:        LICENSE
 Copyright:           Vincent Hanquez <vincent@snarc.org>
 Author:              Vincent Hanquez <vincent@snarc.org>
 Maintainer:          Vincent Hanquez <vincent@snarc.org>
-Synopsis:            ASN1 data reader/writer in RAW/BER/DER/CER forms
+Synopsis:            ASN1 data reader and writer in RAW, BER, DER and CER forms
 Build-Type:          Simple
 Category:            Data
 stability:           experimental
 Cabal-Version:       >=1.6
+Homepage:            http://github.com/vincenthz/hs-asn1-data
 data-files:          README, TODO
 
 
@@ -20,10 +21,10 @@
   Default:           False
 
 Library
-  Build-Depends:     base >= 3 && < 5,
+  Build-Depends:     base >= 3 && < 7,
                      binary >= 0.5,
                      bytestring,
-                     mtl
+                     monads-fd
   Exposed-modules:   Data.ASN1.BER
                      Data.ASN1.CER
                      Data.ASN1.DER
@@ -36,7 +37,7 @@
   Main-Is:           Tests.hs
   if flag(test)
     Buildable:       True
-    Build-depends:   base >= 3 && < 5, HUnit, QuickCheck >= 2, bytestring
+    Build-depends:   base >= 3 && < 7, HUnit, QuickCheck >= 2, bytestring
   else
     Buildable:       False
 
