implemented comparision before and after