Removed redundant code, and moved updateLocation() outside of the loop.