Added deletion of empty panels.