refactored code changing .toggleClass to .hide