Implemented basic leave event

PS: sorry my editor removed some trailing spaces.