analyse_block_end: tidy this up ..