wrote a func to consolidate all the segment blocks so we can find unused pages
tidying the block consolidation code