added leave functionality