Cleanup, use stdout helper in populate_history command