solution for flow_control exercise 2