Initial checkin of write_input