Return the history instead of printing it. Better for API.