added support to log out when command succeeds #20