#17, #23, #31 Improved edit modes switching and activation, fixed event leaks