add xep0012, clean code