main echo function