implemented canonical location detection