Removed unused headers
Corrected formula for output files