refactor cli into a cleaner model for passing around state