added temp data members. added writer function.