Modified code to transfer byte arrays instead of strings, as stringified data incurred strange behaviour(a byte had the  possibility to equal end of line in string land)