Slight improvements in javascript code.