Changed serial eading to event based. Writing is not working perfectly.