refactory + show table content on click