integrating old js code