refactoring of controller
added handling cancellation of access