clean up javascript, fix bug with map move