Improve autodetection and add default input