Wrap all JS in a function, in prep for reorganization.
Break "latest measurements" out into its own functions and JSON callbacks.