 					}
 				}
 				else {
-					outfield.appendText("\ncwd: " + ev.currentDirectory.nativePath);
+					log("cwd: " + ev.currentDirectory.nativePath);
 					return ev.currentDirectory.nativePath;
 				}
 				return "";
 			}
 		}
+
+		private function log(message:String="", add_new_line:Boolean=true):void {
+			outfield.appendText((add_new_line ? "\n" : "") + message);
+		}
+
 		//Invoke handler called when started
 		private function onInvoke(ev:InvokeEvent):void {
 
 			inputFilePath = getInputFile(ev);
 			outputDirPath = getOutputDir(ev);
 
-			outfield.appendText("\nInput file: " + inputFilePath);
-			outfield.appendText("\nOutput directory: " + outputDirPath);
+			log("Input file: " + inputFilePath);
+			log("Output directory: " + outputDirPath);
 			loadSwf();
 		}
 

			loadedSwf = MovieClip(ev.target.content);
			outputWidth = Math.ceil(ev.target.width);
			outputHeight = Math.ceil(ev.target.height);
			outfield.appendText("\nLoaded!");
			totalFrames = loadedSwf.totalFrames;
			outfield.appendText("\nFrame count: " + totalFrames);

			calculateBBox();


					return "";
				}
				prefix = matches[1];
				log("Prefix: " + prefix);
				var f:File = new File(ev.currentDirectory.nativePath);
				f = f.resolvePath(inputFileName);
				if(!f.exists) {
					log("Input file not found!");
					//Input file not found
					exit(3);
					return "";
