Added validation for quantity