new version of writeInput