Very minor style comment: These lines should only be indented one level under the `when`, not two levels.