added ternary for optional collapse on closed