moved js function