added url tracking of location and cleaned up code a bit