Refactored example to be more idiomatic