added authentication and fixed linefeeds