Move 'link' to else block in case of "good" query.