improve with_history feature