Refactored table oupt functions into a more generic list based version.