Refactor recursion slightly and add protection against bluetooth name unknown.