refactored to move tag logic to helper library, so it can more easily be shared among multiple views