Reverted back to previous code.  Error in javascript