Improve JS control