show and hide feature refactored