added namespace and using enum instead of int error return values