Updating code and tests to reflect recent changes