refactor: added "remove_redundant_tags" function