refactor to show and hide functions