refactored hiding and displaying slides