Move JavaScript helpers to own file