diff --git a/Makefile b/Makefile
deleted file mode 100644
index 7411535..0000000
--- a/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-LIBS = -ldbus-1
-INCLUDE = -I/usr/include/dbus-1.0/ -I/usr/lib/dbus-1.0/include
-TARGET = dbus.so
-
-all: $(TARGET)
-
-$(TARGET): dbus.scm
-	csc -dynamic $(INCLUDE) -o $(TARGET) dbus.scm $(LIBS)
-
-dbus.egg:
-	tar zcvf dbus.egg dbus.meta dbus.setup dbus.scm dbus.html doc test --exclude \.svn*
diff --git a/dbus.meta b/dbus.meta
index 671ae38..b339278 100644
--- a/dbus.meta
+++ b/dbus.meta
@@ -1,26 +1,8 @@
-((egg "dbus.egg")
-
-; all the files that should be bundled as part of the egg
- (files "dbus.scm" "dbus.setup" "dbus.html"
-	"examples/send-signal.scm"
-	"examples/send-example-query.scm"
-	"examples/introspect-hal.scm"
-	"examples/introspect-services.scm"
-	"examples/listen-example.scm"
-	"examples/introspect-phonekit.scm"
-	"examples/introspect-avahi.scm"
-	"examples/paranoid-android.scm"
-	"examples/send-car-turn.scm"
-	"examples/receive-car-turn.scm"
-	"examples/receive-signal.scm"
- )
-
- (license "MIT")
+;;; dbus.meta -*- Scheme -*-
 
+((synopsis "A binding for libdbus, the IPC mechanism")
  (category os)
-
+ (license "MIT")
+ (depends easyffi protobj matchable miscmacros foreigners)
  (doc-from-wiki)
-
- (author "Shawn Rutledge")
-
- (synopsis "A binding for libdbus, the IPC mechanism"))
+ (author "Shawn Rutledge"))
diff --git a/dbus.scm b/dbus.scm
index 6ae8305..52aed89 100644
--- a/dbus.scm
+++ b/dbus.scm
@@ -1,57 +1,29 @@
-(declare (export
-	;=====
-	; functions
+;;;; dbus.scm
+
+(module dbus (dbus:make-context
+	      dbus:send
+	      dbus:call
+	      dbus:make-method-proxy
+	      dbus:register-signal-handler
+	      dbus:register-method
+	      dbus:enable-polling-thread!
+	      dbus:poll-for-message
+	      dbus:discover-services
+	      dbus:discover-api-xml
+	      dbus:dbus-service
+	      dbus:type-uint32
+	      dbus:session-bus
+	      dbus:system-bus
+	      dbus:starter-bus
+	      dbus:known-bus-count
+	      dbus:register-path)
+	(import scheme chicken
+		(except foreign foreign-declare)
+		foreigners
+		easyffi
+		miscmacros)
+	(use srfi-18)
 
-	; Construct a context structure
-	dbus:make-context
-
-	; Send a message (call a remote method)
-	dbus:send
-
-	; Wrap dbus:send in a lambda which you can use just like a local function
-	dbus:make-sender
-
-	; Send a method call, then block until the reply is received
-	; and return the reply value(s) as a list
-	dbus:call
-
-	; Wrap dbus:call in a lambda which you can use just like a local function
-	dbus:make-method-proxy
-
-	; Register a callback to handle a particular signal
-	dbus:register-signal-handler
-
-	; Register a callback to handle a particular method
-	dbus:register-method
-
-	; By default, dbus:register-method starts a polling thread
-	; if there is not yet one.  Call (dbus:enable-polling-thread enable: #f)
-	; to disable it.  If you later call (dbus:enable-polling-thread enable: #t)
-	; it will start the polling thread immediately, whether there are
-	; any registered methods or not.
-	dbus:enable-polling-thread!
-
-	; Manually poll for a new message
-	dbus:poll-for-message
-
-	; Get the list of service names available on a bus
-	dbus:discover-services
-
-	; Get the XML API documentation for a service
-	; (if the service implements org.freedesktop.DBus.Introspectable)
-	dbus:discover-api-xml
-
-	;=====
-	; constants
-	dbus:dbus-service
-	dbus:type-uint32
-	dbus:session-bus
-	dbus:system-bus
-	dbus:starter-bus
-	; dbus:known-bus-count
-))
-
-(use srfi-18)
 
 #>
 	#include <dbus/dbus.h>
@@ -120,8 +92,18 @@
 
 (define dbus:make-context)
 (define dbus:send)
+(define dbus:make-method-proxy)
+(define dbus:call)
 (define dbus:flush)
 (define dbus:poll-for-message)
+(define dbus:register-signal-handler)
+(define dbus:register-method)
+(define dbus:register-path)
+(define dbus:enable-polling-thread!)
+
+(define dbus:add-match)
+(define dbus:request-name)
+
 
 (define find-callback)
 
@@ -176,11 +158,11 @@
 
     (define (any->string arg)
       (if (string? arg)
-        arg
-        (if (eq? (void) arg)
-          ""
-          (format "~a" arg)
-        )))
+	arg
+	(if (eq? (void) arg)
+	  ""
+	  (format "~a" arg)
+	)))
 
 	(define (symbol?->string arg)
 		(if (symbol? arg)
@@ -570,15 +552,15 @@
 								[reply-args (iter->list reply-iter)] )
 							reply-args))))))
 
-	(define-foreign-record (dbus:vtable "struct DBusObjectPathVTable")
+	(define-foreign-record-type (dbus:vtable "struct DBusObjectPathVTable")
 		(constructor: dbus:make-vtable-impl)
 		(destructor: dbus:free-vtable)
-		(c-pointer unregister_function)
-		(c-pointer message_function)
-		(c-pointer dbus_internal_pad1)
-		(c-pointer dbus_internal_pad2)
-		(c-pointer dbus_internal_pad3)
-		(c-pointer dbus_internal_pad4))
+		(c-pointer unregister_function dbus:vtable-unregister_function dbus:vtable-unregister_function-set!)
+		(c-pointer message_function dbus:vtable-message_function dbus:vtable-message_function-set!)
+		(c-pointer dbus_internal_pad1 dbus:vtable-dbus_internal_pad1)
+		(c-pointer dbus_internal_pad2 dbus:vtable-dbus_internal_pad2)
+		(c-pointer dbus_internal_pad3 dbus:vtable-dbus_internal_pad3)
+		(c-pointer dbus_internal_pad4 dbus:vtable-dbus_internal_pad4))
 
 	(define (dbus:make-vtable cb unreg-cb)
 		(let ()
@@ -637,14 +619,6 @@
 				") conn bus timeout)
 		)))
 
-	(set! dbus:enable-polling-thread! (lambda (#!key (bus dbus:session-bus) (enable #t) (interval default-polling-interval))
-		(vector-set! polling-enabled bus enable)
-		(if enable
-			(dbus:start-polling! bus interval)
-			(let ([th (vector-ref polling-threads bus)])
-				(when th (thread-join! th))))))
-
-
 	;; TODO: one polling thread is necessary for each connection
 	(define (dbus:start-polling! bus interval)
 		(vector-set! polling-interval bus interval)
@@ -658,6 +632,13 @@
 						(thread-sleep! (vector-ref polling-interval bus))
 						(when (vector-ref polling-enabled bus) (loop)))))))))
 
+	(set! dbus:enable-polling-thread! (lambda (#!key (bus dbus:session-bus) (enable #t) (interval default-polling-interval))
+		(vector-set! polling-enabled bus enable)
+		(if enable
+			(dbus:start-polling! bus interval)
+			(let ([th (vector-ref polling-threads bus)])
+				(when th (thread-join! th))))))
+
 	;; Wraps a user-provided callback so as to pass it the
 	;; received dbus message's parameters, and return a dbus response
 	;; with the parameter(s) returned from the callback.
@@ -730,3 +711,4 @@
 				(and (pair? xml) (car xml))))))
 
 )
+)
\ No newline at end of file
diff --git a/dbus.setup b/dbus.setup
index edeb1e5..3f31ddd 100644
--- a/dbus.setup
+++ b/dbus.setup
@@ -1,28 +1,43 @@
+;;;; dbus.setup -*- Scheme -*-
 
-(define has-exports? (string>=? (chicken-version) "2.310"))
+(use files utils)
 
-(compile -s -O2 -d1
-	,@(if has-exports? '(-check-imports -emit-exports dbus.exports) '())
-	-ldbus-1 -I/usr/include/dbus-1.0/ -I/usr/lib/dbus-1.0/include
-	dbus.scm)
+;; (define has-exports? (string>=? (chicken-version) "2.310"))
+
+(define prefix (installation-prefix))
+(define libpath (make-pathname prefix "lib"))
+(define incpath (make-pathname prefix "include"))
+(define binpath (make-pathname prefix "bin"))
+(define csc (make-pathname binpath "csc"))
+
+(make (("dbus.import.so" ("dbus.c")
+	(run (,csc -s -O3 -d0 dbus.import.scm)))
+       ("dbus.so" ("dbus.c")
+	(run (,csc -s -O3 -d1 dbus.scm
+		   -ldbus-1 -I/usr/include/dbus-1.0/ -I/usr/lib/dbus-1.0/include)))
+       ("dbus.c" ("dbus.scm")
+	(run (,csc -t dbus.scm -O3 -d1 -X easyffi -C -g -j dbus))))
+ '("dbus.so" "dbus.import.so"))
+
+;; (compile -s -O2 -d1
+;; 	,@(if has-exports? '(-emit-exports dbus.exports) '())
+;; 	-ldbus-1 -I/usr/include/dbus-1.0/ -I/usr/lib/dbus-1.0/include
+;; 	dbus.scm)
 
 (install-extension 'dbus
-	`("dbus.so"
-		"dbus.html"
-		,@(if has-exports? '("dbus.exports") '()) )
-	`((version 0.85)
-		,@(if has-exports? `((exports "dbus.exports")) '())
-		(documentation "dbus.html")
-		(examples
-			"examples/introspect-avahi.scm"
-			"examples/introspect-services.scm"
-			"examples/receive-car-turn.scm"
-			"examples/send-example-query.scm"
-			"examples/introspect-hal.scm"
-			"examples/listen-example.scm"
-			"examples/receive-signal.scm"
-			"examples/send-signal.scm"
-			"examples/introspect-phonekit.scm"
-			"examples/paranoid-android.scm"
-			"examples/send-car-turn.scm"
-		)))
+		   `("dbus.so" "dbus.import.so")
+		   `((version 0.85)
+		     (examples
+		      "examples/introspect-avahi.scm"
+		      "examples/introspect-services.scm"
+		      "examples/receive-car-turn.scm"
+		      "examples/send-example-query.scm"
+		      "examples/introspect-hal.scm"
+		      "examples/listen-example.scm"
+		      "examples/receive-signal.scm"
+		      "examples/send-signal.scm"
+		      "examples/introspect-phonekit.scm"
+		      "examples/paranoid-android.scm"
+		      "examples/send-car-turn.scm")))
+
+;; pkg-config dbus-1 --cflags
