cleaned up  processTable code