refactoring classes and managing tags revised