implement proper history display with correct parentheses