Refactoring of table output