Further social-binding cleanup
diff --git a/jpa-moxy/round-trip/.gitignore b/jpa-moxy/round-trip/.gitignore
new file mode 100644
index 0000000..5e56e04
--- /dev/null
+++ b/jpa-moxy/round-trip/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/jpa-moxy/round-trip/.project b/jpa-moxy/round-trip/.project
new file mode 100644
index 0000000..15966b8
--- /dev/null
+++ b/jpa-moxy/round-trip/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>round-trip</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+	</natures>
+</projectDescription>
diff --git a/moxy/social-binding/.classpath b/moxy/social-binding/.classpath
index af50fd9..5a30989 100644
--- a/moxy/social-binding/.classpath
+++ b/moxy/social-binding/.classpath
@@ -22,14 +22,14 @@
 			<attribute name="maven.pomderived" value="true"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
 		<attributes>
 			<attribute name="maven.pomderived" value="true"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
 		<attributes>
-			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="owner.project.facets" value="java"/>
 		</attributes>
 	</classpathentry>
 	<classpathentry kind="output" path="target/classes"/>
diff --git a/moxy/social-binding/.project b/moxy/social-binding/.project
index 20dedc4..8cc4d2d 100644
--- a/moxy/social-binding/.project
+++ b/moxy/social-binding/.project
@@ -6,6 +6,11 @@
 	</projects>
 	<buildSpec>
 		<buildCommand>
+			<name>org.eclipse.wst.common.project.facet.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
 			<name>org.eclipse.jdt.core.javabuilder</name>
 			<arguments>
 			</arguments>
@@ -19,5 +24,6 @@
 	<natures>
 		<nature>org.eclipse.jdt.core.javanature</nature>
 		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
 	</natures>
 </projectDescription>
diff --git a/moxy/social-binding/.settings/org.eclipse.jdt.core.prefs b/moxy/social-binding/.settings/org.eclipse.jdt.core.prefs
index 60105c1..443e085 100644
--- a/moxy/social-binding/.settings/org.eclipse.jdt.core.prefs
+++ b/moxy/social-binding/.settings/org.eclipse.jdt.core.prefs
@@ -1,5 +1,8 @@
 eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/moxy/social-binding/.settings/org.eclipse.wst.common.project.facet.core.xml b/moxy/social-binding/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 0000000..bc0009a
--- /dev/null
+++ b/moxy/social-binding/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+  <installed facet="java" version="1.7"/>
+</faceted-project>
diff --git a/moxy/social-binding/src/main/resources/META-INF/bindings-flickr.xml b/moxy/social-binding/doc/bindings-flickr.xml
similarity index 100%
rename from moxy/social-binding/src/main/resources/META-INF/bindings-flickr.xml
rename to moxy/social-binding/doc/bindings-flickr.xml
diff --git a/moxy/social-binding/src/main/resources/META-INF/bindings-reddit.xml b/moxy/social-binding/doc/bindings-reddit.xml
similarity index 100%
rename from moxy/social-binding/src/main/resources/META-INF/bindings-reddit.xml
rename to moxy/social-binding/doc/bindings-reddit.xml
diff --git a/moxy/social-binding/output.html b/moxy/social-binding/output.html
deleted file mode 100644
index 63831ea..0000000
--- a/moxy/social-binding/output.html
+++ /dev/null
@@ -1,146 +0,0 @@
-<html>
-   <head>
-      <title>EclipseLink MOXy - Dynamic JAXB</title>
-      <link href="style.css" rel="stylesheet" type="text/css" media="screen"/>
-   </head>
-   <body>
-      <p>
-         <h1>Reddit /software - Today's Top Posts</h1>
-         <p>
-            <div id="redditPost">
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlTextLink">
-                  <a href="http://www.reddit.com/r/software/comments/1g5vp5/a_good_suggestion_for_softwarefreeware_that/">a good suggestion for software/freeware that allows me to control a PC remotely?</a>
-               </span>
-            </div>
-         </p>
-         <p>
-            <div id="flickrResults">
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlText">
-                  <p>
-                     <small>Recent Uploads tagged suggestion and software</small>
-                  </p>
-               </span>
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlImageLink">
-                  <a href="http://www.flickr.com/photos/blacktar/5354218744/">
-                     <img src="http://farm6.staticflickr.com/5083/5354218744_d6e32b0cd4_b.jpg" height="80"/>
-                  </a>
-               </span>
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlImageLink">
-                  <a href="http://www.flickr.com/photos/54934586@N07/5101667292/">
-                     <img src="http://farm2.staticflickr.com/1401/5101667292_078ab6a092_b.jpg" height="80"/>
-                  </a>
-               </span>
-            </div>
-         </p>
-         <p>
-            <div id="redditPost">
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlTextLink">
-                  <a href="http://www.reddit.com/r/software/comments/1g4mw2/scheduling_software_best_licensed_programs/">Scheduling software; Best licensed programs available?</a>
-               </span>
-            </div>
-         </p>
-         <p>
-            <div id="flickrResults">
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlText">
-                  <p>
-                     <small>Recent Uploads tagged scheduling and software</small>
-                  </p>
-               </span>
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlImageLink">
-                  <a href="http://www.flickr.com/photos/netia_software/8488393481/">
-                     <img src="http://farm9.staticflickr.com/8252/8488393481_1a2910fb2d_b.jpg" height="80"/>
-                  </a>
-               </span>
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlImageLink">
-                  <a href="http://www.flickr.com/photos/netia_software/6458702713/">
-                     <img src="http://farm8.staticflickr.com/7030/6458702713_a0ea9252cc_b.jpg" height="80"/>
-                  </a>
-               </span>
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlImageLink">
-                  <a href="http://www.flickr.com/photos/netia_software/8489506126/">
-                     <img src="http://farm9.staticflickr.com/8230/8489506126_9d2afd7db1_b.jpg" height="80"/>
-                  </a>
-               </span>
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlImageLink">
-                  <a href="http://www.flickr.com/photos/netia_software/8489487824/">
-                     <img src="http://farm9.staticflickr.com/8091/8489487824_365cac0298_b.jpg" height="80"/>
-                  </a>
-               </span>
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlImageLink">
-                  <a href="http://www.flickr.com/photos/netia_software/6458724523/">
-                     <img src="http://farm8.staticflickr.com/7150/6458724523_aeffd22187_b.jpg" height="80"/>
-                  </a>
-               </span>
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlImageLink">
-                  <a href="http://www.flickr.com/photos/nancycahille/6835701758/">
-                     <img src="http://farm8.staticflickr.com/7179/6835701758_b76d642d74_b.jpg" height="80"/>
-                  </a>
-               </span>
-            </div>
-         </p>
-         <p>
-            <div id="redditPost">
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlTextLink">
-                  <a href="http://peterbiggs.areavoices.com/2013/06/11/ediscovery-and-electronic-forensics-alternative-charge-preparations/">E-Discovery and Electronic Forensics: Alternative Charge Preparations</a>
-               </span>
-            </div>
-         </p>
-         <p>
-            <div id="flickrResults">
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlText">
-                  <p>
-                     <small>Recent Uploads tagged preparations and ediscovery</small>
-                  </p>
-               </span>
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlText">
-                  <p>
-                     <small>No results found.</small>
-                  </p>
-               </span>
-            </div>
-         </p>
-         <p>
-            <div id="redditPost">
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlTextLink">
-                  <a href="http://www.youtube.com/watch?v=5_7VhCt1kRg&amp;amp;rel=false">Can’t decide what to do tonight? Now, there’s an app for that...</a>
-               </span>
-            </div>
-         </p>
-         <p>
-            <div id="flickrResults">
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlText">
-                  <p>
-                     <small>Recent Uploads tagged tonight and there’s</small>
-                  </p>
-               </span>
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlText">
-                  <p>
-                     <small>No results found.</small>
-                  </p>
-               </span>
-            </div>
-         </p>
-         <p>
-            <div id="redditPost">
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlTextLink">
-                  <a href="http://arturotoms.bcz.com/2013/06/11/ediscovery-and-digital-forensics-alternative-charge-preparations/">Electronic Discovery and Digital Forensics: Alternative Charge Preparations</a>
-               </span>
-            </div>
-         </p>
-         <p>
-            <div id="flickrResults">
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlText">
-                  <p>
-                     <small>Recent Uploads tagged preparations and alternative</small>
-                  </p>
-               </span>
-               <span xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="htmlText">
-                  <p>
-                     <small>No results found.</small>
-                  </p>
-               </span>
-            </div>
-         </p>
-      </p>
-   </body>
-</html>
\ No newline at end of file
diff --git a/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/FlikrReader.java b/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/FlikrReader.java
index 9304a43..309def1 100644
--- a/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/FlikrReader.java
+++ b/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/FlikrReader.java
@@ -10,6 +10,7 @@
  ******************************************************************************/
 package eclipselink.example.moxy.socialbinding;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
@@ -52,24 +53,13 @@
 
     }
 
-    public Map<Object, DynamicEntity> readFlickrResults(Map<Object, DynamicEntity> redditMap) throws Exception {
-        Map<Object, DynamicEntity> results = new HashMap<Object, DynamicEntity>();
-        
-        for (Object postUrl : redditMap.keySet()) {
+    public Map<String, DynamicEntity> readFlickrResults(Map<String, DynamicEntity> redditMap) {
+        Map<String, DynamicEntity> results = new HashMap<String, DynamicEntity>();
+
+        for (String postUrl : redditMap.keySet()) {
             DynamicEntity post = redditMap.get(postUrl);
+            DynamicEntity flickrResults = readFlickrResult(postUrl, post);
 
-            System.out.println();
-            System.out.println("Headline: [" + post.get("title") + "]");
-
-            String keywords = new KeywordExtractor().extractKeywords(post.get("title").toString());
-
-            String flickrUrlString = FLICKR_URL + keywords;
-            System.out.print("Searching Flickr: [" + flickrUrlString + "]... ");
-            InputStream flickrStream = new URL(flickrUrlString).openConnection().getInputStream();
-            System.out.println("Done.");
-
-            Unmarshaller u = context.createUnmarshaller();
-            DynamicEntity flickrResults = (DynamicEntity) u.unmarshal(flickrStream);
 
             results.put(postUrl, flickrResults);
 
@@ -86,8 +76,40 @@
                 System.out.println("\tNo results found.");
             }
         }
-        
+
         return results;
+
+    }
+
+    public DynamicEntity readFlickrResult(String postUrl, DynamicEntity post) {
+
+        System.out.println("\nHeadline: [" + post.get("title") + "]");
+
+        String keywords = new KeywordExtractor().extractKeywords(post.get("title").toString());
+
+        String flickrUrlString = FLICKR_URL + keywords;
+        System.out.print("Searching Flickr: [" + flickrUrlString + "]... ");
+
+        InputStream flickrStream = null;
+
+        try {
+            flickrStream = new URL(flickrUrlString).openConnection().getInputStream();
+
+            System.out.println("Done.");
+
+            Unmarshaller u = context.createUnmarshaller();
+            return (DynamicEntity) u.unmarshal(flickrStream);
+        } catch (IOException | JAXBException e) {
+            throw new RuntimeException("FLIKR access failed", e);
+        } finally {
+            if (flickrStream != null) {
+                try {
+                    flickrStream.close();
+                } catch (IOException e) {// ignore in this example }
+                }
+            }
+        }
+
     }
 
     // ========================================================================
diff --git a/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/HTMLWriter.java b/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/HTMLWriter.java
index a50f8ea..fcab2aa 100644
--- a/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/HTMLWriter.java
+++ b/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/HTMLWriter.java
@@ -10,7 +10,6 @@
  ******************************************************************************/
 package eclipselink.example.moxy.socialbinding;
 
-import java.awt.Desktop;
 import java.io.File;
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -19,6 +18,7 @@
 import java.util.Map;
 import java.util.Random;
 
+import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Marshaller;
 
@@ -28,6 +28,7 @@
 import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory;
 
 /**
+ * HTML writer using dynamic MOXy to marshall into HTML.
  * 
  * @author rbarkhous
  * @since EclipseLink 2.4.2
@@ -36,8 +37,10 @@
 
     private DynamicJAXBContext context;
 
-    private File outputFile;
-
+    /**
+     * Create the {@link JAXBContext} that MOXy will use for HTML writing
+     * (Marshalling)
+     */
     public HTMLWriter() {
         ClassLoader loader = Thread.currentThread().getContextClassLoader();
 
@@ -53,19 +56,17 @@
         } catch (JAXBException e) {
             throw new RuntimeException("Context creation failed", e);
         }
-
-        outputFile = new File("output.html");
     }
 
-    public void write(String topic, int imageLimit, Map<Object, DynamicEntity> redditMap, Map<Object, DynamicEntity> flickrMap) throws Exception {
-        DynamicEntity html = context.newDynamicEntity("eclipselink.example.moxy.dynamic.flickr.HtmlPage");
-        html.set("title", "EclipseLink MOXy - Dynamic JAXB");
+    public File write(String topic, String fileLocation, int imageLimit, Map<String, DynamicEntity> redditMap, Map<String, DynamicEntity> flickrMap) {
+        DynamicEntity html = context.newDynamicEntity("HtmlPage");
+        html.set("title", "EclipseLink Social Binding Example");
         html.set("css", "style.css");
         html.set("rel", "stylesheet");
         html.set("type", "text/css");
         html.set("media", "screen");
 
-        DynamicEntity body = context.newDynamicEntity("eclipselink.example.moxy.dynamic.flickr.HtmlBody");
+        DynamicEntity body = context.newDynamicEntity("HtmlBody");
         body.set("title", "Reddit /" + topic + " - Today's Top Posts");
 
         ArrayList<DynamicEntity> divs = new ArrayList<DynamicEntity>();
@@ -77,12 +78,12 @@
             // Article Link
             // ================================================================
 
-            DynamicEntity redditDiv = context.newDynamicEntity("eclipselink.example.moxy.dynamic.flickr.HtmlDiv");
+            DynamicEntity redditDiv = context.newDynamicEntity("HtmlDiv");
             redditDiv.set("id", "redditPost");
 
             ArrayList<DynamicEntity> divContent = new ArrayList<DynamicEntity>();
 
-            DynamicEntity redditLink = context.newDynamicEntity("eclipselink.example.moxy.dynamic.flickr.HtmlTextLink");
+            DynamicEntity redditLink = context.newDynamicEntity("HtmlTextLink");
             redditLink.set("url", post.get("url"));
             redditLink.set("title", post.get("title"));
             divContent.add(redditLink);
@@ -92,12 +93,12 @@
             // Flickr description and images
             // ================================================================
 
-            DynamicEntity flickrDiv = context.newDynamicEntity("eclipselink.example.moxy.dynamic.flickr.HtmlDiv");
+            DynamicEntity flickrDiv = context.newDynamicEntity("HtmlDiv");
             flickrDiv.set("id", "flickrResults");
 
             divContent = new ArrayList<DynamicEntity>();
 
-            DynamicEntity flickrDescription = context.newDynamicEntity("eclipselink.example.moxy.dynamic.flickr.HtmlText");
+            DynamicEntity flickrDescription = context.newDynamicEntity("HtmlText");
             flickrDescription.set("text", flickrResults.get("description"));
             divContent.add(flickrDescription);
 
@@ -107,7 +108,7 @@
             if (flickrItems != null) {
                 Collections.shuffle(flickrItems, new Random(System.nanoTime()));
                 for (DynamicEntity flickrItem : flickrItems) {
-                    DynamicEntity flickrImageLink = context.newDynamicEntity("eclipselink.example.moxy.dynamic.flickr.HtmlImageLink");
+                    DynamicEntity flickrImageLink = context.newDynamicEntity("HtmlImageLink");
                     flickrImageLink.set("url", flickrItem.get("flickrPage"));
                     flickrImageLink.set("image", flickrItem.get("imageUrl"));
                     flickrImageLink.set("height", HTML_IMAGE_HEIGHT);
@@ -118,7 +119,7 @@
                     }
                 }
             } else {
-                DynamicEntity noneText = context.newDynamicEntity("eclipselink.example.moxy.dynamic.flickr.HtmlText");
+                DynamicEntity noneText = context.newDynamicEntity("HtmlText");
                 noneText.set("text", "No results found.");
                 divContent.add(noneText);
             }
@@ -132,24 +133,21 @@
 
         html.set("body", body);
 
-        Marshaller m = context.createMarshaller();
-        m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
-        m.setProperty(Marshaller.JAXB_FRAGMENT, true);
-        m.marshal(html, outputFile);
-    }
-
-    public void launchSystemBrowser() {
+        Marshaller m;
         try {
-            Desktop.getDesktop().browse(outputFile.toURI());
-        } catch (Exception e) {
-            e.printStackTrace();
+            m = context.createMarshaller();
+            m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+            m.setProperty(Marshaller.JAXB_FRAGMENT, true);
+            File outputFile = new File(fileLocation);
+            m.marshal(html, outputFile);
+            return outputFile;
+        } catch (JAXBException e) {
+            throw new RuntimeException("HTML marshall failed", e);
         }
     }
 
     // ========================================================================
 
     private final String HTML_BINDINGS = "META-INF/bindings-html.xml";
-
-    private final Integer HTML_IMAGE_HEIGHT = Integer.valueOf(80);
-
+    private final Integer HTML_IMAGE_HEIGHT = 80;
 }
\ No newline at end of file
diff --git a/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/KeywordExtractor.java b/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/KeywordExtractor.java
index 8f3cf93..2a7744d 100644
--- a/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/KeywordExtractor.java
+++ b/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/KeywordExtractor.java
@@ -16,6 +16,8 @@
 import java.util.StringTokenizer;
 
 /**
+ * Simple utility class to extract and prioritize a set of keywords based on the
+ * title provided.
  * 
  * @author rbarkhous
  * @since EclipseLink 2.4.2
diff --git a/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/Main.java b/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/Main.java
index cc2f025..c418f16 100644
--- a/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/Main.java
+++ b/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/Main.java
@@ -10,11 +10,14 @@
  ******************************************************************************/
 package eclipselink.example.moxy.socialbinding;
 
+import java.awt.Desktop;
+import java.io.File;
 import java.util.Map;
 
 import org.eclipse.persistence.dynamic.DynamicEntity;
 
 /**
+ * Main example execution.
  * 
  * @author rbarkhous
  * @since EclipseLink 2.4.2
@@ -22,15 +25,22 @@
 public class Main {
 
     public static void main(String[] args) {
-        String topic = "software";
-        
-        try {
-            Map<Object, DynamicEntity> redditResults = new RedditReader().readRedditPosts(topic);
-            Map<Object, DynamicEntity> flickrResults = new FlikrReader().readFlickrResults(redditResults);
+        File file = create("technology", "target/classes/output.html", 5);
 
-            HTMLWriter writer = new HTMLWriter();
-            writer.write(topic, 6, redditResults, flickrResults);
-            writer.launchSystemBrowser();
+        launchSystemBrowser(file);
+    }
+
+    public static File create(String topic, String targetFile, int maxResults) {
+        Map<String, DynamicEntity> redditResults = new RedditReader().readRedditPosts(topic);
+        Map<String, DynamicEntity> flickrResults = new FlikrReader().readFlickrResults(redditResults);
+
+        HTMLWriter writer = new HTMLWriter();
+        return writer.write(topic, targetFile, maxResults, redditResults, flickrResults);
+    }
+
+    public static void launchSystemBrowser(File file) {
+        try {
+            Desktop.getDesktop().browse(file.toURI());
         } catch (Exception e) {
             e.printStackTrace();
         }
diff --git a/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/RedditReader.java b/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/RedditReader.java
index 9f61af6..ad19979 100644
--- a/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/RedditReader.java
+++ b/moxy/social-binding/src/main/java/eclipselink/example/moxy/socialbinding/RedditReader.java
@@ -21,6 +21,7 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.eclipse.persistence.dynamic.DynamicEntity;
+import org.eclipse.persistence.dynamic.DynamicType;
 import org.eclipse.persistence.jaxb.JAXBContextProperties;
 import org.eclipse.persistence.jaxb.UnmarshallerProperties;
 import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
@@ -28,6 +29,9 @@
 import org.eclipse.persistence.oxm.MediaType;
 
 /**
+ * Example of using EclipseLink MOXy to read (unmarshall) the JSON returned from
+ * Reddit (http://www.reddit.com/). It uses the available interface that returns
+ * JSON based on a provided topic.
  * 
  * @author rbarkhous
  * @since EclipseLink 2.4.2
@@ -53,28 +57,36 @@
         }
     }
 
-    public Map<Object, DynamicEntity> readRedditPosts(String topic) throws Exception {
-        Unmarshaller u = context.createUnmarshaller();
-        u.setProperty(UnmarshallerProperties.MEDIA_TYPE, MediaType.APPLICATION_JSON);
-        u.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false);
+    public Map<String, DynamicEntity> readRedditPosts(String topic) {
+        DynamicEntity redditResults = null;
 
-        Class<? extends DynamicEntity> redditResultsClass = context.newDynamicEntity("eclipselink.example.moxy.dynamic.flickr.RedditResults").getClass();
+        try {
+            Unmarshaller u = context.createUnmarshaller();
+            u.setProperty(UnmarshallerProperties.MEDIA_TYPE, MediaType.APPLICATION_JSON);
+            u.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false);
 
-        System.out.println();
-        System.out.print("Reading Today's Hot Topics from Reddit r/" + topic + "... ");
-        DynamicEntity redditResults = u.unmarshal(new StreamSource(getRedditURL(topic)), redditResultsClass).getValue();
+            DynamicType resultType = this.context.getDynamicType("RedditResults");
+            Class<? extends DynamicEntity> redditResultsClass = resultType.getJavaClass();
+
+            System.out.print("\nReading Today's Hot Topics from Reddit r/" + topic + "... ");
+
+            redditResults = u.unmarshal(new StreamSource(getRedditURL(topic)), redditResultsClass).getValue();
+        } catch (JAXBException e) {
+            throw new RuntimeException("Unmarshall from REDDIT failed", e);
+        }
+
         System.out.println("Done.");
 
         List<DynamicEntity> posts = redditResults.get("posts");
-        Map<Object, DynamicEntity> results = new HashMap<Object, DynamicEntity>();
+        Map<String, DynamicEntity> results = new HashMap<String, DynamicEntity>();
 
         for (DynamicEntity post : posts) {
-            results.put(post.get("url"), post);
+            results.put(post.get("url").toString(), post);
         }
 
         return results;
     }
-    
+
     private String getRedditURL(String topic) {
         return "http://www.reddit.com/r/" + topic + "/top/.json?sort=top&t=today&limit=" + REDDIT_LIMIT;
     }
@@ -82,5 +94,5 @@
     // See http://www.reddit.com/dev/api
     private final int REDDIT_LIMIT = 5;
 
-    private final String REDDIT_BINDINGS = "META-INF/bindings-reddit.xml";
+    private final String REDDIT_BINDINGS = "META-INF/bindings-reddit.json";
 }
\ No newline at end of file
diff --git a/moxy/social-binding/style.css b/moxy/social-binding/src/main/resources/style.css
similarity index 100%
rename from moxy/social-binding/style.css
rename to moxy/social-binding/src/main/resources/style.css