Update code and test based on comments in #112