diff --git a/examples/test.c b/examples/test.c
index 0e6d83ec3d12dad230eb58f05df063e487ed3104..55c84ba2c4b75e1075409a5a1474c9d5f8adc087 100644
--- a/examples/test.c
+++ b/examples/test.c
@@ -862,6 +862,8 @@ int main ( int argc , char *argv[] ) {
 	    parts[k].x[2] += shift[2];
       }
 
+    for(k=0; k<10; ++k)
+      printParticle(parts, k);
             
     /* Dump the kernel to make sure its ok. */
     // kernel_dump( 100 );
diff --git a/src/Makefile.am b/src/Makefile.am
index b9c1212f9b3a0e9111f410636efa05400c8efba2..5c2cfd0bb32b19763c100db7dc3e0ee4f6fbb5c1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,9 +31,9 @@ AM_LDFLAGS = $(LAPACK_LIBS) $(BLAS_LIBS) $(HDF5_LDFLAGS) -version-info 0:0:0
 
 # Build the libswiftsim library
 lib_LTLIBRARIES = libswiftsim.la
-libswiftsim_la_SOURCES = space.c runner.c queue.c task.c cell.c engine.c input.c timers.c
+libswiftsim_la_SOURCES = space.c runner.c queue.c task.c cell.c engine.c input.c timers.c debug.c
 
 # List required headers
 include_HEADERS = space.h runner.h queue.h task.h lock.h cell.h part.h const.h \
-    engine.h swift.h io.h timers.h
+    engine.h swift.h io.h timers.h debug.h
 
diff --git a/src/debug.c b/src/debug.c
new file mode 100644
index 0000000000000000000000000000000000000000..194666f9a2e5ca6d7a7fb0c03aeb4de4c064dacd
--- /dev/null
+++ b/src/debug.c
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * This file is part of SWIFT.
+ * Coypright (c) 2012 Matthieu Schaller (matthieu.schaller@durham.ac.uk).
+ * 
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * 
+ ******************************************************************************/
+
+
+#include <stdio.h>
+
+#include "part.h"
+
+void printParticle(struct part *parts, int i)
+{
+  printf("## Particle[%d]: id= %lld x=( %f, %f, %f) v=( %f, %f, %f) h= %f m= %f rho= %f u= %f dt= %f\n",
+	 i,
+	 parts[i].id,
+	 parts[i].x[0], parts[i].x[1], parts[i].x[2],
+	 parts[i].v[0], parts[i].v[1], parts[i].v[2],
+	 parts[i].h,
+	 parts[i].mass,
+	 parts[i].rho,
+	 parts[i].u,
+	 parts[i].dt
+	 );
+}
+
diff --git a/src/debug.h b/src/debug.h
new file mode 100644
index 0000000000000000000000000000000000000000..a75c61a1d5ca989c6c4406c9cb4b680ea0bf1ceb
--- /dev/null
+++ b/src/debug.h
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * This file is part of SWIFT.
+ * Coypright (c) 2012 Matthieu Schaller (matthieu.schaller@durham.ac.uk).
+ * 
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * 
+ ******************************************************************************/
+
+
+
+
+void printParticle(struct part *parts, int i);
diff --git a/src/input.c b/src/input.c
index f43e94289358cadd78a58c2f9bced0e17d56cf16..64e8ef9139757cd82a7b24e3818f0042b862f5a0 100644
--- a/src/input.c
+++ b/src/input.c
@@ -36,65 +36,7 @@
 #include "task.h"
 #include "part.h"
 #include "space.h"
-
-/* Error macro. */
-#define error(s) { fprintf( stderr , "%s:%s():%i: %s\n" , __FILE__ , __FUNCTION__ , __LINE__ , s ); abort(); }
-
-
-/**
- * @brief The different types of data used in the GADGET IC files.
- *
- * (This is admittedly a poor substitute to C++ templates...)
- */
-enum DATA_TYPE{INT, LONG, LONGLONG, UINT, ULONG, ULONGLONG, FLOAT, DOUBLE};
-
-/**
- * @brief The two sorts of data present in the GADGET IC files: compulsory to start a run or optional.
- *
- */
-enum DATA_IMPORTANCE{COMPULSORY=1, OPTIONAL=0};
-
-/**
- * @brief Converts a C data type to the HDF5 equivalent. 
- *
- * This function is a trivial wrapper around the HDF5 types but allows
- * to change the exact storage types matching the code types in a transparent way.
- */
-hid_t hdf5Type(enum DATA_TYPE type)
-{
-  switch(type)
-    {
-    case INT: return H5T_NATIVE_INT;
-    case UINT: return H5T_NATIVE_UINT;
-    case LONG: return H5T_NATIVE_LONG;
-    case ULONG: return H5T_NATIVE_ULONG;
-    case LONGLONG: return H5T_NATIVE_LLONG;
-    case ULONGLONG: return H5T_NATIVE_ULLONG;
-    case FLOAT: return H5T_NATIVE_FLOAT;
-    case DOUBLE: return H5T_NATIVE_DOUBLE;
-    default: error("Unknown type");
-    }
-}
-
-
-/**
- * @brief Returns the memory size of the data type
- */
-size_t sizeOfType(enum DATA_TYPE type)
-{
-  switch(type)
-    {
-    case INT: return sizeof(int);
-    case UINT: return sizeof(unsigned int);
-    case LONG: return sizeof(long);
-    case ULONG: return sizeof(unsigned long);
-    case LONGLONG: return sizeof(long long);
-    case ULONGLONG: return sizeof(unsigned long long);
-    case FLOAT: return sizeof(float);
-    case DOUBLE: return sizeof(double);
-    default: error("Unknown type");
-    }
-}
+#include "io_types.h"
 
 
 /**
diff --git a/src/swift.h b/src/swift.h
index c3a0c894b9b4a26b6bc0e2a9ef30c77e1c79c23c..4308a49431de32d6aabb44a17d3975d01be56aeb 100644
--- a/src/swift.h
+++ b/src/swift.h
@@ -34,3 +34,4 @@
 #include "runner_iact.h"
 #include "engine.h"
 #include "io.h"
+#include "debug.h"