table2: refactoring to be able to add rotated mode