Added validations on data types, some other minor improvements