Fixing location detection bug + Changes the data structure