Adding JS function