renaming JS functions and moving old JS code to search js.