better logic, better cancel implementation