Add leaving support

Fix #32