refactor quantityValidator