refactor "echo" command