added counter for conditional hiding