Move hide code in the popup

Closes #94