finished dynamicFun exercise