worked on refactoring the javascript to work with new ui