Adjusted JS to avoid blocking