added todo. Made name also pass by reference. and made a writefile function