Add Test and Fix Logic