Expand if else line in table helper to be more readable