Added autoDetect method