added validations for empty and invalid values