refactored tag-retrieving/moving logic a little bit