added writer functions for creating text files