refactoring start and end tag