Added validation for hex input