A few fixups
Starting to get autodetection working, in a hacky way
Working further on detection, still wonky