adapt JS script