A method for determining a location of a device, comprising: selecting a group of four access points that are determined to form a convex quadrilateral around the device based on the location coordinates of the access points and previously determined location coordinates of the device; receiving, from each access point in the group, a time-of-flight (ToF) measurement relative to the device; determining a respective distance of the device from each access point in the group using the ToF measurements and a baseToF value, wherein the baseToF value is an estimate of a delay caused by a chipset of the device; and determining location coordinates of the device and a new baseToF value, based on the determined distances and the location coordinates of each access point in the group, wherein the method further comprises if it is determined based on the current determined location coordinates of the device that the current group of access points no longer forms a convex quadrilateral around the device or that the current group of access points does not form a smallest convex quadrilateral around the device: based on the determined location coordinates of the device, selecting a new group of four access points that are determined to form a convex quadrilateral around the device; receiving, from each access point in the new group, a second ToF measurement relative to the device; determining a second respective distance of the device from each access point in the new group using the second ToF measurements and the new baseToF value; and determining second location coordinates of the device and a second new baseToF value, based on the determined second distances and the location coordinates of each access point in the new group. selecting a group of four access points that are determined to form a convex quadrilateral around the device based on the location coordinates of the access points and previously determined location coordinates of the device; receiving, from each access point in the group, a time-of-flight (ToF) measurement relative to the device; determining a respective distance of the device from each access point in the group using the ToF measurements and a baseToF value, wherein the baseToF value is an estimate of a delay caused by a chipset of the device; and determining location coordinates of the device and a new baseToF value, based on the determined distances and the location coordinates of each access point in the group, wherein the method further comprises if it is determined based on the current determined location coordinates of the device that the current group of access points no longer forms a convex quadrilateral around the device or that the current group of access points does not form a smallest convex quadrilateral around the device: based on the determined location coordinates of the device, selecting a new group of four access points that are determined to form a convex quadrilateral around the device; receiving, from each access point in the new group, a second ToF measurement relative to the device; determining a second respective distance of the device from each access point in the new group using the second ToF measurements and the new baseToF value; and determining second location coordinates of the device and a second new baseToF value, based on the determined second distances and the location coordinates of each access point in the new group. based on the determined location coordinates of the device, selecting a new group of four access points that are determined to form a convex quadrilateral around the device; receiving, from each access point in the new group, a second ToF measurement relative to the device; determining a second respective distance of the device from each access point in the new group using the second ToF measurements and the new baseToF value; and determining second location coordinates of the device and a second new baseToF value, based on the determined second distances and the location coordinates of each access point in the new group.