Latest working code, with location updates