Added primitive type reading and writing