changes so that panels collapse correctly