Added clear function to js code.