fix id inconsistency
save state using local storage
extract JS and default content from index.html