define helper functions for formatting table