added redirect of output and file parsing error handling