interface detection now pretty ugly but it works