diff --git a/pyramid/numcore/phase_mag_real.c b/pyramid/numcore/phase_mag_real.c
index 7d7b55e1979b79b3d381004c317498979b63e70b..3d391e95765e45b1d3747985a17519cb9e2a6955 100644
--- a/pyramid/numcore/phase_mag_real.c
+++ b/pyramid/numcore/phase_mag_real.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.19.1 on Tue Jul 23 11:18:13 2013 */
+/* Generated by Cython 0.19.1 on Tue Jul 23 16:03:31 2013 */
 
 #define PY_SSIZE_T_CLEAN
 #ifndef CYTHON_USE_PYLONG_INTERNALS
diff --git a/scripts/create_logo.py b/scripts/create_logo.py
index 070a48d9d8bc00aebcb0df1c1eda6fbc7e812f3d..a83af16d0b9534122481234ca318c8c19b071915 100644
--- a/scripts/create_logo.py
+++ b/scripts/create_logo.py
@@ -1,3 +1,4 @@
+#! python
 # -*- coding: utf-8 -*-
 """Create the Pyramid-Logo."""
 
diff --git a/setup.py b/setup.py
index 1b9a5b4a9596a8905a3b4253f987349fdd558028..d90599684b12b69e2766e7a9bc60aff708fe5b1a 100644
--- a/setup.py
+++ b/setup.py
@@ -15,40 +15,43 @@ import numpy
 import os
 import sys
 import sysconfig
+#import glob
 
-from distutils.core import setup
+#from distutils.core import setup
 from distutils.command.build import build
-from distutils.extension import Extension
+#from distutils.extension import Extension
+
 from Cython.Distutils import build_ext
 
-class custom_build(build):
-    def run(self):
-        build.run(self)
-        print 'Test'
+from setuptools import setup, find_packages
 
-def distutils_dir_name(dname):
-    '''Returns the name of a distutils build directory'''
-    path = "{dirname}.{platform}-{version[0]}.{version[1]}"
-    return path.format(dirname=dname, platform=sysconfig.get_platform(), version=sys.version_info)
+from setuptools.extension import Extension
 
 
-print '\n------------------------------------------------------------------------------'
+def make_hgrevision(target, source, env):
+    import subprocess as sp
+    output = sp.Popen(["hg", "id", "-i"], stdout=sp.PIPE).communicate()[0]
+    hgrevision_cc = file(str(target[0]), "w")
+    hgrevision_cc.write('HG_Revision = "{0}"\n'.format(output.strip()))
+    hgrevision_cc.close()
 
-build_path = os.path.join('build', distutils_dir_name('lib'))
+print '\n------------------------------------------------------------------------------'
 
 setup(
-
       name = 'Pyramid',
       version = '0.1',
       description = 'PYthon based Reconstruction Algorithm for MagnetIc Distributions',
       author = 'Jan Caron',
       author_email = 'j.caron@fz-juelich.de',
       
-      packages = ['pyramid', 'pyramid.numcore', 'pyramid.test'],
+      packages = find_packages(exclude=['test']),#['pyramid', 'pyramid.numcore', 'test', 'scripts'],
       include_dirs = [numpy.get_include()],
       requires = ['numpy', 'matplotlib'],
-                      
-      cmdclass = {'build_ext': build_ext, 'build': custom_build},
+      
+      scripts = ['scripts/create_logo.py'],
+      test_suite = 'test',
+      
+      cmdclass = {'build_ext': build_ext},
       ext_package = 'pyramid/numcore',
       ext_modules = [
           Extension('phase_mag_real', ['pyramid/numcore/phase_mag_real.pyx'], 
@@ -56,13 +59,6 @@ setup(
                     extra_compile_args=["-march=native", "-mtune=native"]
                     )
           ]
-
 )
 
-import os
-print os.getcwd()
-
 print '------------------------------------------------------------------------------\n'
-
-#import pyramid.test as test
-#test.run_tests()
diff --git a/test/__init__.py b/test/__init__.py
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3827142a682f0c22c20c6f4c2f979e07e898f7dc 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -0,0 +1,26 @@
+import unittest
+from test_compliance import TestCaseCompliance
+from test_magcreator import TestCaseMagCreator
+from test_magdata import TestCaseMagData
+from test_projector import TestCaseProjector
+from test_phasemapper import TestCasePhaseMapper
+from test_phasemap import TestCasePhaseMap
+from test_holoimage import TestCaseHoloImage
+from test_analytic import TestCaseAnalytic
+from test_reconstructor import TestCaseReconstructor
+
+
+def load_suite():
+    
+    loader = unittest.TestLoader()
+    suite = unittest.TestSuite()
+    suite.addTest(loader.loadTestsFromTestCase(TestCaseCompliance))
+    suite.addTest(loader.loadTestsFromTestCase(TestCaseMagCreator))
+    suite.addTest(loader.loadTestsFromTestCase(TestCaseMagData))
+    suite.addTest(loader.loadTestsFromTestCase(TestCaseProjector))
+    suite.addTest(loader.loadTestsFromTestCase(TestCasePhaseMapper))
+    suite.addTest(loader.loadTestsFromTestCase(TestCasePhaseMap))
+    suite.addTest(loader.loadTestsFromTestCase(TestCaseHoloImage))
+    suite.addTest(loader.loadTestsFromTestCase(TestCaseAnalytic))
+    suite.addTest(loader.loadTestsFromTestCase(TestCaseReconstructor))
+    return suite
diff --git a/test/run_tests.py b/test/run_tests.py
deleted file mode 100644
index a3c6eb0ffe4380c9bca84510c8a2e7338b2710c9..0000000000000000000000000000000000000000
--- a/test/run_tests.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Unittests for pyramid."""
-
-import unittest
-from test_compliance import TestCaseCompliance
-from test_magcreator import TestCaseMagCreator
-from test_magdata import TestCaseMagData
-from test_projector import TestCaseProjector
-from test_phasemapper import TestCasePhaseMapper
-from test_phasemap import TestCasePhaseMap
-from test_holoimage import TestCaseHoloImage
-from test_analytic import TestCaseAnalytic
-from test_reconstructor import TestCaseReconstructor
-
-
-def run():
-
-    suite = unittest.TestSuite()
-    loader = unittest.TestLoader()
-    runner = unittest.TextTestRunner(verbosity=2)
-
-    suite.addTest(loader.loadTestsFromTestCase(TestCaseCompliance))
-    suite.addTest(loader.loadTestsFromTestCase(TestCaseMagCreator))
-    suite.addTest(loader.loadTestsFromTestCase(TestCaseMagData))
-    suite.addTest(loader.loadTestsFromTestCase(TestCaseProjector))
-    suite.addTest(loader.loadTestsFromTestCase(TestCasePhaseMapper))
-    suite.addTest(loader.loadTestsFromTestCase(TestCasePhaseMap))
-    suite.addTest(loader.loadTestsFromTestCase(TestCaseHoloImage))
-    suite.addTest(loader.loadTestsFromTestCase(TestCaseAnalytic))
-    suite.addTest(loader.loadTestsFromTestCase(TestCaseReconstructor))
-    runner.run(suite)
-
-
-if __name__ == '__main__':
-    run()
diff --git a/test/test_compliance.py b/test/test_compliance.py
index ec901a1052945a38c8d479a20bf03482c58227eb..a78ca8499d6705c79ace45b4fea055c46edc922d 100644
--- a/test/test_compliance.py
+++ b/test/test_compliance.py
@@ -30,14 +30,16 @@ class TestCaseCompliance(unittest.TestCase):
 
     def test_pep8(self):
         # TODO: Docstring
-        files = self.get_files_to_check('../../pyramid') + self.get_files_to_check('../../scripts')
+        files = self.get_files_to_check('pyramid') \
+              + self.get_files_to_check('scripts') \
+              + self.get_files_to_check('test')
         ignores = ('E226', 'E128')
         pep8.MAX_LINE_LENGTH = 99
         pep8style = pep8.StyleGuide(quiet=False)
         pep8style.options.ignore = ignores
 
         stdout_buffer = sys.stdout
-        with open(os.path.join('..', '..', 'output', 'pep8_log.txt'), 'w') as sys.stdout:
+        with open(os.path.join('output', 'pep8_log.txt'), 'w') as sys.stdout:
             print '<<< PEP8 LOGFILE >>>'
             print 'RUN:', datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
             print 'IGNORED RULES:', ', '.join(ignores)