Jsrefactor

Initial JS refactor largely complete, merging back to master to push the filetree functionality forward.