Added button toggling logic