cleaned up `settags()`.

used local vars and improved code readability.