Canceling improved and some refactoring:DRAFT