re-organize lookup code

Re use the table & summary printing code