Issue #21628: Tidied up code