Move getlocation to separate file