simplified the js functionality