update table.js clean up code