Reimplementing window dismantling

I hope I don't have to do this again.