some checks and loose ends tidied