split 'show' function to smaller functions