created algorithem to find tags