Added collapsing and fixed deletion

It works!