Shared state working.
Clean up some javascript