Extracted function for executing the example