refactoring to avoid 'that' reference and improve maintenance