* Export state cli * More work * Fix tests * Make it work * Fix compilation * Apply suggestions from code review