Added functionality to dynamically add lines to tables
Some refactoring