tags support, refactoring