factored button hide show logic