Added rx flush function