file output added

added bool to switch between test mode and file output mode