changed file opens to include directories
fixed typos in output part
fixed sprintf calls
removed diagnostic print statements
removed diagnostic print statements
removed free() calls; causing weird fatal error
removed free() functions; causing weird error