added autodetectiong