Refactored example to be more idiomatic

Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>