Change primary condition checking and file writer mode