Js convert to functions

Merge changed file