added validation for cost