changed js function