Assignment 8 Dynamic Control Flow Solution