refactored code to use .hide()