refactor javascript structure. initial add issue implementation