updated js code for results