moved pragma statements to write function