private void applyComments(String filename, Map<String,List<Comment>> comments) throws IOException
	{
		// read new file's text
		StringBuffer buffer = this.getNewFileSource(filename);

		// create output file
		File outputFile = new File(this._outDir + filename);

		// make sure our file's directory exists
		outputFile.getParentFile().mkdirs();

		// insert comments
		Iterator<Map.Entry<String, List<Comment>>> i = comments.entrySet().iterator();

		while (i.hasNext())
		{
			Map.Entry<String, List<Comment>> entry = i.next();
			String followingLine = entry.getKey();
			List<Comment> values = entry.getValue();
			int offset = 0;

			for (int j = 0; j < values.size(); j++)
			{
				Comment comment = values.get(j);
				int currentOffset = offset;

				offset = buffer.indexOf(followingLine, currentOffset);

				// handle case where this constructs changed to object literals
				if (offset == -1)
				{
					if (followingLine.startsWith(THIS_DOT))
					{
						String transformedLine = followingLine.substring(THIS_DOT.length()).replace('=', ':').replaceAll(";$", ",");
						
						offset = buffer.indexOf(transformedLine, currentOffset);
						
						if (offset == -1)
						{
							transformedLine = transformedLine.replaceAll(" : ", ": ");
							
							offset = buffer.indexOf(transformedLine, currentOffset);
						}
					}
				}
				
				if (offset != -1)
				{
					int lineStart = offset;
					
					if (offset > 0)
					{
						lineStart = this.findLineStart(buffer, offset - 1);
					}
						
					if (this.followsMultiLineComment(buffer, lineStart - 1) == false)
					{
						// append inserted text
						String prefix = buffer.substring(lineStart, offset);
						buffer.insert(lineStart, prefix + "\n");
						buffer.insert(offset, comment.getText());
						
						offset += prefix.length() + 1 + comment.getText().length() + 1;
					}
					else
					{
						String alias = this.extractAlias(comment.getText());
						
						offset += this.injectAlias(buffer, lineStart, alias) + 1;
					}
				}
				else
				{
					System.out.println("  Couldn't find: " + followingLine);
					
					offset = 0;
				}
			}
		}

		// write content to new file
		FileWriter fw = new FileWriter(outputFile);
		fw.write(buffer.toString());
		fw.close();
	}