Adjust js code