Refactor cancel methode code