Added general logic for hiding