Added check for valid total cost