Added function to load JS only if it's needed