refactor history and echo