fix tags and refactor