minor bugfixes in adding delelting and editing labels, also refactoring