refactoring the js
better tables