Shifted most of cli code into play function.