changed input method to write as a file