changed logic in history creation