Re-factored createReport method. Also added checking for overwriting of file.