fixed tags and more refactoring