diff --git a/bond.cabal b/bond.cabal
--- a/bond.cabal
+++ b/bond.cabal
@@ -2,8 +2,9 @@
 -- Licensed under the MIT license. See LICENSE file in the project root for full license information.
 
 name:               bond
-version:            0.4.0.1
+version:            0.4.0.2
 cabal-version:      >= 1.8
+tested-with:        GHC>=7.4.1
 synopsis:           Bond schema compiler and code generator
 description:        Bond is a cross-platform framework for handling schematized
                     data. It supports cross-language de/serialization and
@@ -27,7 +28,7 @@
 maintainer:         Adam Sapek <adamsap@microsoft.com>
 bug-reports:        https://github.com/Microsoft/bond/issues
 copyright:          Copyright (c) Microsoft. All rights reserved.
-category:           Language
+category:           Language, Compiler, Code Generation
 build-type:         Simple
 
 source-repository head
@@ -42,6 +43,7 @@
                     filepath >= 1.0,
                     mtl >= 2.1,
                     parsec >= 3.1,
+                    scientific >= 0.3.4.6,
                     shakespeare >= 2.0,
                     text >= 0.11
   ghc-options:      -Wall
@@ -88,7 +90,7 @@
                     derive,
                     HUnit,
                     QuickCheck,
-                    Diff >= 0.2 && < 0.4,
+                    Diff >= 0.2 && <= 0.3.2,
                     pretty,
                     tasty,
                     tasty-golden,
diff --git a/src/Language/Bond/Codegen/Cpp/Util.hs b/src/Language/Bond/Codegen/Cpp/Util.hs
--- a/src/Language/Bond/Codegen/Cpp/Util.hs
+++ b/src/Language/Bond/Codegen/Cpp/Util.hs
@@ -139,7 +139,6 @@
         };|]
   where
     constant Constant {..} = [lt|#{constantName}#{optional value constantValue}|]
-    value (-2147483648) = [lt| = -2147483647-1|]
-    value x = [lt| = #{x}|]
+    value (-2147483648) = [lt| = static_cast<int32_t>(-2147483647-1)|]
+    value x = [lt| = static_cast<int32_t>(#{x})|]
 enumDefinition _ = error "enumDefinition: impossible happened."
-
diff --git a/src/Language/Bond/Codegen/Cs/Types_cs.hs b/src/Language/Bond/Codegen/Cs/Types_cs.hs
--- a/src/Language/Bond/Codegen/Cs/Types_cs.hs
+++ b/src/Language/Bond/Codegen/Cs/Types_cs.hs
@@ -40,6 +40,7 @@
     -> FieldMapping         -- ^ Specifies how to represent schema fields
     -> MappingContext -> String -> [Import] -> [Declaration] -> (String, Text)
 types_cs structMapping fieldMapping cs _ _ declarations = (fileSuffix, [lt|
+#{CS.disableCscWarnings}
 #{CS.disableReSharperWarnings}
 namespace #{csNamespace}
 {
@@ -139,7 +140,7 @@
     }|]
       where
         -- constant
-        constant Constant {..} = let value x = [lt| = #{x}|] in
+        constant Constant {..} = let value x = [lt| = unchecked((int)#{x})|] in
             [lt|#{constantName}#{optional value constantValue},|]
 
     typeDefinition _ = mempty
diff --git a/src/Language/Bond/Codegen/Cs/Util.hs b/src/Language/Bond/Codegen/Cs/Util.hs
--- a/src/Language/Bond/Codegen/Cs/Util.hs
+++ b/src/Language/Bond/Codegen/Cs/Util.hs
@@ -9,6 +9,7 @@
     , schemaAttributes
     , paramConstraints
     , defaultValue
+    , disableCscWarnings
     , disableReSharperWarnings
     ) where
 
@@ -23,6 +24,12 @@
 import Language.Bond.Syntax.Util
 import Language.Bond.Codegen.TypeMapping
 import Language.Bond.Codegen.Util
+
+disableCscWarnings :: Text
+disableCscWarnings = [lt|
+// suppress "Missing XML comment for publicly visible type or member"
+#pragma warning disable 1591
+|]
 
 disableReSharperWarnings :: Text
 disableReSharperWarnings = [lt|
diff --git a/src/Language/Bond/Codegen/CustomMapping.hs b/src/Language/Bond/Codegen/CustomMapping.hs
--- a/src/Language/Bond/Codegen/CustomMapping.hs
+++ b/src/Language/Bond/Codegen/CustomMapping.hs
@@ -25,7 +25,7 @@
 -- | Specification of a type alias mapping.
 data AliasMapping = AliasMapping
     { aliasName :: QualifiedName        -- ^ qualified name of a type alias
-    , aliasTemplate :: [Fragment]       -- ^ list of fragments comprising custom mapping for the alias
+    , aliasTemplate :: [Fragment]       -- ^ list of fragments comprising the custom mapping for the alias
     }
 
 -- | Specification of namespace mapping.
diff --git a/src/Language/Bond/Codegen/TypeMapping.hs b/src/Language/Bond/Codegen/TypeMapping.hs
--- a/src/Language/Bond/Codegen/TypeMapping.hs
+++ b/src/Language/Bond/Codegen/TypeMapping.hs
@@ -10,8 +10,8 @@
 Stability   : provisional
 Portability : portable
 
-The module defines abstractions for mapping from the Bond type system into the
-type systems of a target programming language.
+This module defines abstractions for mapping from the Bond type system into the
+type system of a target programming language.
 -}
 
 module Language.Bond.Codegen.TypeMapping
@@ -65,8 +65,8 @@
 import Language.Bond.Codegen.CustomMapping
 
 -- | The 'MappingContext' encapsulates information about mapping Bond types
--- into types of code generation target language. A context instance is passed
--- to code generation templates.
+-- into types in the target language. A context instance is passed to code
+-- generation templates.
 data MappingContext = MappingContext
     { typeMapping :: TypeMapping
     , aliasMapping :: [AliasMapping]
@@ -74,7 +74,7 @@
     , namespaces :: [Namespace]
     }
 
--- | An opaque type representing type mapping.
+-- | An opaque type representing a type mapping.
 data TypeMapping = TypeMapping
     { language :: Maybe Language
     , global :: Builder
@@ -89,7 +89,7 @@
 type TypeNameBuilder = Reader MappingContext Builder
 
 -- | Returns the namespace for the 'MappingContext'. The namespace may be
--- different than specified in schema definition file due to
+-- different than specified in the schema definition file due to
 -- <#namespace-mapping namespace mapping>.
 getNamespace :: MappingContext -> QualifiedName
 getNamespace c@MappingContext {..} = resolveNamespace c namespaces
diff --git a/src/Language/Bond/Parser.hs b/src/Language/Bond/Parser.hs
--- a/src/Language/Bond/Parser.hs
+++ b/src/Language/Bond/Parser.hs
@@ -24,6 +24,7 @@
 import Data.Ord
 import Data.List
 import Data.Function
+import Data.Word
 import Control.Applicative
 import Control.Monad.Reader
 import Prelude
@@ -233,12 +234,12 @@
     with params e = e { currentParams = params }
     unique p = do
         fields' <- p
-        case findDuplicates fields' of
+        case findDuplicatesBy fieldOrdinal fields' ++ findDuplicatesBy fieldName fields' of
             [] -> return fields'
-            Field {..}:_ -> fail $ "Duplicate definition of the field with ordinal " ++ show fieldOrdinal
+            Field {..}:_ -> fail $ "Duplicate definition of the field with ordinal " ++ show fieldOrdinal ++
+                " and name " ++ show fieldName
       where
-        findDuplicates xs = deleteFirstsBy ordinal xs (nubBy ordinal xs)
-        ordinal = (==) `on` fieldOrdinal
+        findDuplicatesBy accessor xs = deleteFirstsBy ((==) `on` accessor) xs (nubBy ((==) `on` accessor) xs)
 
 manySortedBy :: (a -> a -> Ordering) -> ParsecT s u m a -> ParsecT s u m [a]
 manySortedBy = manyAccum . insertBy
@@ -247,7 +248,13 @@
 field :: Parser Field
 field = makeField <$> attributes <*> ordinal <*> modifier <*> ftype <*> identifier <*> optional default_
   where
-    ordinal = (fromIntegral <$> integer) <* colon <?> "field ordinal"
+    ordinal = word16 <* colon <?> "field ordinal"
+      where
+        word16 = do
+            i <- integer
+            if i <= toInteger (maxBound :: Word16) && i >= toInteger (minBound :: Word16)
+                then return (fromInteger i)
+                else fail "Field ordinal must be within the range 0-65535"
     modifier = option Optional
                     (keyword "optional" *> pure Optional
                  <|> keyword "required" *> pure Required
diff --git a/src/Language/Bond/Syntax/SchemaDef.hs b/src/Language/Bond/Syntax/SchemaDef.hs
--- a/src/Language/Bond/Syntax/SchemaDef.hs
+++ b/src/Language/Bond/Syntax/SchemaDef.hs
@@ -36,7 +36,7 @@
 import Language.Bond.Codegen.TypeMapping
 
 -- | Returns an instance of <https://microsoft.github.io/bond/manual/compiler.html#runtime-schema SchemaDef>
--- for the specified type. The SchemaDef is encoded using Bond Simple JSON
+-- for the specified type. The SchemaDef is encoded using the Bond Simple JSON
 -- protocol and returned as a lazy 'BL.ByteString'.
 encodeSchemaDef :: Type -> BL.ByteString
 encodeSchemaDef = encode . makeSchemaDef
