Fixed threading
Bugfixes and JS updates