file writing in correct format now.