move example to function