Refactored code for showing and hiding protocol widgets