Fixed up the TableNav function