Edited main function to handle files