Bugfixes, JS improvements