added possibility to change tags, refactored some code