refactor getting tags