Included some error validation functions