Move inline JS into onReady blocks