Updated example to improve performance