Move JS to jQuery code