 					}
 				}
 				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();
 		}
 

				Math.ceil(boundsArray.h[0])
			);

			outfield.appendText("\nBounding box: " + bBox)

			outputWidth = bBox.width;
			outputHeight = bBox.height;

					exit(4);
					return "";
				}
				log("inpt: " + d.nativePath);
				return d.nativePath;
			}
			else {
