Index: trunk/psastro/src/psastro.c
===================================================================
--- trunk/psastro/src/psastro.c	(revision 6791)
+++ trunk/psastro/src/psastro.c	(revision 6792)
@@ -16,17 +16,30 @@
     psastroDataLoop (input, config);
 
-    // simple layout interpretation, basic WCS conversion
-    pmFPA *fpa = psastroBuildFPA (header, rawstars);
+    // select astrometry stars from the psphot sources
+    // limit fit to bright stars only 
+    psastroSelectAstromStars (config);
 
-    // limit fit to bright stars only 
-    psastroSelectBrightStars (fpa, config);
+    // load the reference stars overlapping the data stars
+    psastroLoadReference (config);
 
     // fpa and subset point to the same astrometry terms
-    psastroChipAstrom (fpa, config);
+    switch (mode) {
+      case stack:
+	psastroStackAstrom (config);
+	break
+      case mosaic:
+	psastroMosaicAstrom (config);
+	break
+      case mosaic:
+	psastroMosaicAstrom (config);
+	break;
+      default:
+	break;
+    }
 
-    // write out data (cmp file)
-    psastroWriteCMP (fpa, argv[3]);
+    // perform the astrometric solution
+    psastroDataSave (config);
 
-    psLogMsg ("psphot", 3, "complete psphot run: %f sec\n", psTimerMark ("complete"));
+    psLogMsg ("psphot", 3, "complete psastro run: %f sec\n", psTimerMark ("complete"));
 
     psFree (config);
