Improved onshow and onhide