Added write function to File