Adding initial test for table.js, followed by some refactoring of the controller