Upgraded example with return values