rewrote detectiface()