add some code for collapse