Change location type detection and factorize the code