Major refactoring to work on ngMegaTable as a separate module