Have implemented Tomek's suggestions in speeding up the js.