diff --git a/src/reaper.c b/src/reaper.c
index 7e95b21..b8aef02 100644
--- a/src/reaper.c
+++ b/src/reaper.c
@@ -35,6 +35,7 @@ #include <locale.h>
 #endif
 #include <glib/gi18n-lib.h>
 
+
 static VteReaper *singleton_reaper = NULL;
 struct reaper_info {
 	int signum;
@@ -42,6 +43,8 @@ struct reaper_info {
 	int status;
 };
 
+G_DEFINE_TYPE(VteReaper, vte_reaper, G_TYPE_OBJECT)
+
 static void
 vte_reaper_signal_handler(int signum)
 {
@@ -99,12 +102,6 @@ vte_reaper_child_watch_cb(GPid pid, gint
 }
 #endif
 
-static void
-vte_reaper_child_watch_destroyed(gpointer data)
-{
-	/* no-op */
-}
-
 /**
  * vte_reaper_add_child:
  * @pid: the ID of a child process which will be monitored
@@ -124,19 +121,13 @@ #if GLIB_CHECK_VERSION(2,4,0)
 				      pid,
 				      vte_reaper_child_watch_cb,
 				      vte_reaper_get(),
-				      vte_reaper_child_watch_destroyed);
+				      (GDestroyNotify)g_object_unref);
 #endif
 	return VTE_INVALID_SOURCE;
 }
 
 static void
-vte_reaper_channel_destroyed(gpointer data)
-{
-	/* no-op */
-}
-
-static void
-vte_reaper_init(VteReaper *reaper, gpointer *klass)
+vte_reaper_init(VteReaper *reaper)
 {
 	struct sigaction action;
 	int ret;
@@ -163,7 +154,7 @@ #endif
 			    G_IO_IN,
 			    vte_reaper_emit_signal,
 			    reaper,
-			    vte_reaper_channel_destroyed);
+			    NULL);
 
 	/* Set the signal handler. */
 	action.sa_handler = vte_reaper_signal_handler;
@@ -175,6 +166,22 @@ #endif
 	}
 }
 
+static GObject*
+vte_reaper_constructor (GType                  type,
+                        guint                  n_construct_properties,
+                        GObjectConstructParam *construct_properties)
+{
+  if (singleton_reaper) {
+	  return g_object_ref (singleton_reaper);
+  } else {
+	  GObject *obj;
+	  obj = G_OBJECT_CLASS (vte_reaper_parent_class)->constructor (type, n_construct_properties, construct_properties);
+	  singleton_reaper = VTE_REAPER (obj);
+	  return obj;
+  }
+}
+
+
 static void
 vte_reaper_finalize(GObject *reaper)
 {
@@ -197,22 +204,18 @@ vte_reaper_finalize(GObject *reaper)
 	g_source_remove_by_user_data(reaper);
 
 	/* Remove the channel. */
-	g_io_channel_unref((VTE_REAPER(reaper))->channel);
+	g_io_channel_unref(VTE_REAPER(reaper)->channel);
 
 	/* Close the pipes. */
-	close((VTE_REAPER(reaper))->iopipe[1]);
-	close((VTE_REAPER(reaper))->iopipe[0]);
+	close(VTE_REAPER(reaper)->iopipe[1]);
+	close(VTE_REAPER(reaper)->iopipe[0]);
 
-	/* Call the inherited destructor. */
-	object_class = g_type_class_peek(G_TYPE_OBJECT);
-	if (G_OBJECT_CLASS(object_class)->finalize) {
-		(G_OBJECT_CLASS(object_class))->finalize(reaper);
-	}
+	G_OBJECT_CLASS(vte_reaper_parent_class)->finalize(reaper);
 	singleton_reaper = NULL;
 }
 
 static void
-vte_reaper_class_init(VteReaperClass *klass, gpointer data)
+vte_reaper_class_init(VteReaperClass *klass)
 {
 	GObjectClass *gobject_class;
 
@@ -229,38 +232,10 @@ vte_reaper_class_init(VteReaperClass *kl
 						  2, G_TYPE_INT, G_TYPE_INT);
 
 	gobject_class = G_OBJECT_CLASS(klass);
+	gobject_class->constructor = vte_reaper_constructor;
 	gobject_class->finalize = vte_reaper_finalize;
 }
 
-GType
-vte_reaper_get_type(void)
-{
-	static GType reaper_type = 0;
-	static GTypeInfo reaper_type_info = {
-		sizeof(VteReaperClass),
-
-		(GBaseInitFunc)NULL,
-		(GBaseFinalizeFunc)NULL,
-
-		(GClassInitFunc)vte_reaper_class_init,
-		(GClassFinalizeFunc)NULL,
-		NULL,
-
-		sizeof(VteReaper),
-		0,
-		(GInstanceInitFunc) vte_reaper_init,
-
-		(const GTypeValueTable *) NULL,
-	};
-	if (reaper_type == 0) {
-		reaper_type = g_type_register_static(G_TYPE_OBJECT,
-						     "VteReaper",
-						     &reaper_type_info,
-						     0);
-	}
-	return reaper_type;
-}
-
 /**
  * vte_reaper_get:
  *
@@ -272,10 +247,7 @@ vte_reaper_get_type(void)
 VteReaper *
 vte_reaper_get(void)
 {
-	if (!VTE_IS_REAPER(singleton_reaper)) {
-		singleton_reaper = g_object_new(VTE_TYPE_REAPER, NULL);
-	}
-	return singleton_reaper;
+	return g_object_new(VTE_TYPE_REAPER, NULL);
 }
 
 #ifdef REAPER_MAIN
@@ -323,7 +295,7 @@ main(int argc, char **argv)
 		default:
 			g_print("[parent] Starting to wait for %d.\n", p);
 			child = p;
-			g_signal_connect(G_OBJECT(reaper),
+			g_signal_connect(reaper,
 					 "child-exited",
 					 G_CALLBACK(child_exited),
 					 GINT_TO_POINTER(child));
@@ -350,8 +322,7 @@ main(int argc, char **argv)
 
 	g_main_loop_run(loop);
 
-	reaper = vte_reaper_get();
-	g_object_unref(VTE_REAPER(reaper));
+	g_object_unref(reaper);
 
 	return 0;
 }
diff --git a/src/vte.c b/src/vte.c
index bf712bb..e88623f 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -99,7 +99,15 @@ static gboolean vte_terminal_is_processi
 
 static void reset_update_regions (VteTerminal *terminal);
 
-static gpointer parent_class;
+#ifdef VTE_DEBUG
+G_DEFINE_TYPE_WITH_CODE(VteTerminal, vte_terminal, GTK_TYPE_WIDGET,
+		if (_vte_debug_on(VTE_DEBUG_LIFECYCLE)) {
+			g_printerr("vte_terminal_get_type()\n");
+		})
+#else
+G_DEFINE_TYPE(VteTerminal, vte_terminal, GTK_TYPE_WIDGET)
+#endif
+
 
 /* Indexes in the "palette" color array for the dim colors.
  * Only the first VTE_LEGACY_COLOR_SET_SIZE colors have dim versions.  */
@@ -3775,15 +3783,13 @@ vte_terminal_key_press(GtkWidget *widget
 	gunichar keychar = 0;
 	char keybuf[VTE_UTF8_BPC];
 	GdkModifierType modifiers;
-	GtkWidgetClass *widget_class;
 
 	terminal = VTE_TERMINAL(widget);
 
 	/* First, check if GtkWidget's behavior already does something with
 	 * this key. */
-	widget_class = g_type_class_peek(GTK_TYPE_WIDGET);
-	if (GTK_WIDGET_CLASS(widget_class)->key_press_event) {
-		if ((GTK_WIDGET_CLASS(widget_class))->key_press_event(widget,
+	if (GTK_WIDGET_CLASS(vte_terminal_parent_class)->key_press_event) {
+		if ((GTK_WIDGET_CLASS(vte_terminal_parent_class))->key_press_event(widget,
 								      event)) {
 			return TRUE;
 		}
@@ -6656,7 +6662,7 @@ _vte_terminal_codeset_changed_cb(struct 
  * We need to create a new psuedo-terminal pair, read in the termcap file, and
  * set ourselves up to do the interpretation of sequences. */
 static void
-vte_terminal_init(VteTerminal *terminal, gpointer *klass)
+vte_terminal_init(VteTerminal *terminal)
 {
 	VteTerminalPrivate *pvt;
 	GtkWidget *widget;
@@ -6933,7 +6939,6 @@ #endif
 static void
 vte_terminal_show(GtkWidget *widget)
 {
-	GtkWidgetClass *widget_class;
 	VteTerminal *terminal;
 
 #ifdef VTE_DEBUG
@@ -6950,9 +6955,8 @@ #endif
 					   terminal->pvt->fontantialias);
    	}
 
-	widget_class = g_type_class_peek(GTK_TYPE_WIDGET);
-	if (GTK_WIDGET_CLASS(widget_class)->show) {
-		(GTK_WIDGET_CLASS(widget_class))->show(widget);
+	if (GTK_WIDGET_CLASS(vte_terminal_parent_class)->show) {
+		(GTK_WIDGET_CLASS(vte_terminal_parent_class))->show(widget);
 	}
 }
 
@@ -7066,8 +7070,6 @@ vte_terminal_finalize(GObject *object)
 {
 	VteTerminal *terminal;
 	GtkWidget *toplevel;
-	GObjectClass *object_class;
-	GtkWidgetClass *widget_class;
 	GtkClipboard *clipboard;
 	struct vte_match_regex *regex;
 	int i;
@@ -7079,8 +7081,6 @@ #ifdef VTE_DEBUG
 #endif
 
 	terminal = VTE_TERMINAL(object);
-	object_class = G_OBJECT_GET_CLASS(G_OBJECT(object));
-	widget_class = g_type_class_peek(GTK_TYPE_WIDGET);
 
 	/* Free the draw structure. */
 	if (terminal->pvt->draw != NULL) {
@@ -7296,9 +7296,7 @@ #endif
 	}
 
 	/* Call the inherited finalize() method. */
-	if (G_OBJECT_CLASS(widget_class)->finalize) {
-		(G_OBJECT_CLASS(widget_class))->finalize(object);
-	}
+	G_OBJECT_CLASS(vte_terminal_parent_class)->finalize(object);
 }
 
 /* Handle realizing the widget.  Most of this is copy-paste from GGAD. */
@@ -9365,12 +9363,12 @@ vte_terminal_get_accessible(GtkWidget *w
 		first_time = FALSE;
 	}
 
-	return GTK_WIDGET_CLASS (parent_class)->get_accessible (widget);
+	return GTK_WIDGET_CLASS (vte_terminal_parent_class)->get_accessible (widget);
 }
 
 /* Initialize methods. */
 static void
-vte_terminal_class_init(VteTerminalClass *klass, gconstpointer data)
+vte_terminal_class_init(VteTerminalClass *klass)
 {
 	GObjectClass *gobject_class;
 	GtkWidgetClass *widget_class;
@@ -9391,7 +9389,6 @@ #endif
 	gobject_class = G_OBJECT_CLASS(klass);
 	widget_class = GTK_WIDGET_CLASS(klass);
 
-	parent_class = g_type_class_peek_parent (klass);
 	/* Override some of the default handlers. */
 	gobject_class->finalize = vte_terminal_finalize;
 	widget_class->realize = vte_terminal_realize;
@@ -9734,41 +9731,6 @@ vte_terminal_anti_alias_get_type(void)
 	return terminal_anti_alias_type;
 }
 
-GtkType
-vte_terminal_get_type(void)
-{
-	static GtkType terminal_type = 0;
-	static const GTypeInfo terminal_info = {
-		sizeof(VteTerminalClass),
-		(GBaseInitFunc)NULL,
-		(GBaseFinalizeFunc)NULL,
-
-		(GClassInitFunc)vte_terminal_class_init,
-		(GClassFinalizeFunc)NULL,
-		(gconstpointer)NULL,
-
-		sizeof(VteTerminal),
-		0,
-		(GInstanceInitFunc)vte_terminal_init,
-
-		(GTypeValueTable*)NULL,
-	};
-
-	if (terminal_type == 0) {
-#ifdef VTE_DEBUG
-		if (_vte_debug_on(VTE_DEBUG_LIFECYCLE)) {
-			g_printerr("vte_terminal_get_type()\n");
-		}
-#endif
-		terminal_type = g_type_register_static(GTK_TYPE_WIDGET,
-						       "VteTerminal",
-						       &terminal_info,
-						       0);
-	}
-
-	return terminal_type;
-}
-
 /**
  * vte_terminal_set_audible_bell:
  * @terminal: a #VteTerminal
diff --git a/src/vteaccess.c b/src/vteaccess.c
index cb3e9d6..79dc3c6 100644
--- a/src/vteaccess.c
+++ b/src/vteaccess.c
@@ -55,8 +55,9 @@ enum direction {
 
 static gunichar vte_terminal_accessible_get_character_at_offset(AtkText *text,
 								gint offset);
+static gpointer vte_terminal_accessible_parent_class;
 
-static gpointer parent_class = NULL;
+G_DEFINE_TYPE(VteTerminalAccessibleFactory, vte_terminal_accessible_factory, ATK_TYPE_OBJECT_FACTORY)
 
 /* Create snapshot private data. */
 static VteTerminalAccessiblePrivate *
@@ -767,7 +768,7 @@ vte_terminal_initialize (AtkObject *obj,
 	VteTerminal *terminal;
 	AtkObject *parent;
 
-	ATK_OBJECT_CLASS (parent_class)->initialize (obj, data);
+	ATK_OBJECT_CLASS (vte_terminal_accessible_parent_class)->initialize (obj, data);
 
 	terminal = VTE_TERMINAL (data);
 
@@ -858,7 +859,6 @@ vte_terminal_accessible_finalize(GObject
 {
 	VteTerminalAccessiblePrivate *priv;
 	GtkAccessible *accessible = NULL;
-	GObjectClass *gobject_class;
 
 #ifdef VTE_DEBUG
 	if (_vte_debug_on(VTE_DEBUG_MISC)) {
@@ -868,13 +868,10 @@ #endif
 
 	g_assert(VTE_IS_TERMINAL_ACCESSIBLE(object));
 	accessible = GTK_ACCESSIBLE(object);
-	gobject_class = g_type_class_peek_parent(VTE_TERMINAL_ACCESSIBLE_GET_CLASS(object));
 
 	if (accessible->widget != NULL) {
 		g_object_remove_weak_pointer(G_OBJECT(accessible->widget),
 					     (gpointer*) &accessible->widget);
-	}
-	if (G_IS_OBJECT(accessible->widget)) {
 		g_signal_handlers_disconnect_matched(accessible->widget,
 						     G_SIGNAL_MATCH_FUNC |
 						     G_SIGNAL_MATCH_DATA,
@@ -926,9 +923,7 @@ #endif
 				  VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA,
 				  NULL);
 	}
-	if (gobject_class->finalize != NULL) {
-		gobject_class->finalize(object);
-	}
+	G_OBJECT_CLASS(vte_terminal_accessible_parent_class)->finalize(object);
 }
 
 static gchar *
@@ -1813,9 +1808,9 @@ vte_terminal_accessible_class_init(gpoin
 	GObjectClass *gobject_class;
 	AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
 
-	gobject_class = G_OBJECT_CLASS(klass);
+	vte_terminal_accessible_parent_class = g_type_class_peek_parent (klass);
 
-	parent_class = g_type_class_peek_parent (klass);
+	gobject_class = G_OBJECT_CLASS(klass);
 
 	class->initialize = vte_terminal_initialize;
 	/* Override the finalize method. */
@@ -1825,52 +1820,53 @@ vte_terminal_accessible_class_init(gpoin
 GType
 vte_terminal_accessible_get_type(void)
 {
-	AtkRegistry *registry;
-	AtkObjectFactory *factory;
-	GType parent_type, parent_accessible_type;
-	GTypeQuery type_info;
-
 	static GType terminal_accessible_type = 0;
-	static GInterfaceInfo text = {
-		vte_terminal_accessible_text_init,
-		NULL,
-		NULL,
-	};
-	static GInterfaceInfo component = {
-		vte_terminal_accessible_component_init,
-		NULL,
-		NULL,
-	};
-	static GTypeInfo terminal_accessible_info = {
-		0,
-		(GBaseInitFunc)NULL,
-		(GBaseFinalizeFunc)NULL,
-
-		(GClassInitFunc)vte_terminal_accessible_class_init,
-		(GClassFinalizeFunc)NULL,
-		(gconstpointer)NULL,
-
-		0,
-		0,
-		(GInstanceInitFunc) NULL,
-
-		(GTypeValueTable*)NULL,
-	};
-
-	if (terminal_accessible_type == 0) {
+
+	if (G_UNLIKELY (terminal_accessible_type == 0)) {
+		AtkRegistry *registry;
+		AtkObjectFactory *factory;
+		GType parent_type, parent_accessible_type;
+		GTypeQuery type_info;
+
+		GInterfaceInfo text = {
+			vte_terminal_accessible_text_init,
+			NULL,
+			NULL,
+		};
+		GInterfaceInfo component = {
+			vte_terminal_accessible_component_init,
+			NULL,
+			NULL,
+		};
+		GTypeInfo terminal_accessible_info = {
+			0,
+			(GBaseInitFunc)NULL,
+			(GBaseFinalizeFunc)NULL,
+
+			(GClassInitFunc)vte_terminal_accessible_class_init,
+			(GClassFinalizeFunc)NULL,
+			(gconstpointer)NULL,
+
+			0,
+			0,
+			(GInstanceInitFunc) NULL,
+
+			(GTypeValueTable*)NULL,
+		};
+
 		/* Find the Atk object used for the parent (GtkWidget) type. */
 		parent_type = g_type_parent(VTE_TYPE_TERMINAL);
 		factory = atk_registry_get_factory(atk_get_default_registry(),
-						   parent_type);
+				parent_type);
 		parent_accessible_type = atk_object_factory_get_accessible_type(factory);
 		if (!g_type_is_a(parent_accessible_type, GTK_TYPE_ACCESSIBLE)) {
 #ifdef VTE_DEBUG
 			g_warning("Accessibility (%s) is not derived from "
-				  "%s (GTK_MODULES=gail not set?), "
-				  "deriving from %s instead.\n",
-				  g_type_name(parent_accessible_type),
-				  g_type_name(GTK_TYPE_ACCESSIBLE),
-				  g_type_name(GTK_TYPE_ACCESSIBLE));
+					"%s (GTK_MODULES=gail not set?), "
+					"deriving from %s instead.\n",
+					g_type_name(parent_accessible_type),
+					g_type_name(GTK_TYPE_ACCESSIBLE),
+					g_type_name(GTK_TYPE_ACCESSIBLE));
 #endif
 			/* Fudge it. */
 			parent_accessible_type = GTK_TYPE_ACCESSIBLE;
@@ -1882,25 +1878,25 @@ #endif
 		terminal_accessible_info.instance_size = type_info.instance_size;
 		/* Register the class with the GObject type system. */
 		terminal_accessible_type = g_type_register_static(parent_accessible_type,
-								  "VteTerminalAccessible",
-								  &terminal_accessible_info,
-								  0);
+				"VteTerminalAccessible",
+				&terminal_accessible_info,
+				0);
 
 		/* Add a text interface to this object class. */
 		g_type_add_interface_static(terminal_accessible_type,
-					    ATK_TYPE_TEXT,
-					    &text);
+				ATK_TYPE_TEXT,
+				&text);
 		/* Add a component interface to this object class. */
 		g_type_add_interface_static(terminal_accessible_type,
-					    ATK_TYPE_COMPONENT,
-					    &component);
+				ATK_TYPE_COMPONENT,
+				&component);
 
 		/* Associate the terminal and its peer factory in the
 		 * Atk type registry. */
 		registry = atk_get_default_registry();
 		atk_registry_set_factory_type(registry,
-					      VTE_TYPE_TERMINAL,
-					      VTE_TYPE_TERMINAL_ACCESSIBLE_FACTORY);
+				VTE_TYPE_TERMINAL,
+				VTE_TYPE_TERMINAL_ACCESSIBLE_FACTORY);
 	}
 
 	return terminal_accessible_type;
@@ -1929,46 +1925,21 @@ vte_terminal_accessible_factory_class_in
 	/* Override the one method we care about. */
 	class->create_accessible = vte_terminal_accessible_factory_create_accessible;
 }
+static void
+vte_terminal_accessible_factory_init(VteTerminalAccessibleFactory *self)
+{
+	/* nothing to initialise */
+}
 
 AtkObjectFactory *
 vte_terminal_accessible_factory_new(void)
 {
-	GObject *factory;
 #ifdef VTE_DEBUG
 	if (_vte_debug_on(VTE_DEBUG_MISC)) {
 		g_printerr("Creating a new "
 			"VteTerminalAccessibleFactory.\n");
 	}
 #endif
-	factory = g_object_new(VTE_TYPE_TERMINAL_ACCESSIBLE_FACTORY, NULL);
-	g_return_val_if_fail(factory != NULL, NULL);
-	return ATK_OBJECT_FACTORY(factory);
+	return g_object_new(VTE_TYPE_TERMINAL_ACCESSIBLE_FACTORY, NULL);
 }
 
-GType
-vte_terminal_accessible_factory_get_type(void)
-{
-	static GType terminal_accessible_factory_type = 0;
-	static GTypeInfo terminal_accessible_factory_type_info = {
-		sizeof(VteTerminalAccessibleFactoryClass),
-		(GBaseInitFunc)NULL,
-		(GBaseFinalizeFunc)NULL,
-
-		(GClassInitFunc)vte_terminal_accessible_factory_class_init,
-		(GClassFinalizeFunc)NULL,
-		(gconstpointer)NULL,
-
-		sizeof(VteTerminalAccessibleFactory),
-		0,
-		(GInstanceInitFunc)NULL,
-
-		(GTypeValueTable*)NULL,
-	};
-	if (terminal_accessible_factory_type == 0) {
-		terminal_accessible_factory_type = g_type_register_static(ATK_TYPE_OBJECT_FACTORY,
-									  "VteTerminalAccessibleFactory",
-									  &terminal_accessible_factory_type_info,
-									  0);
-	}
-	return terminal_accessible_factory_type;
-}
diff --git a/src/vtebg.c b/src/vtebg.c
index 560b749..3f61692 100644
--- a/src/vtebg.c
+++ b/src/vtebg.c
@@ -26,14 +26,29 @@ #include "vtebg.h"
 
 #include <glib/gi18n-lib.h>
 
+G_DEFINE_TYPE(VteBg, vte_bg, G_TYPE_OBJECT)
+
 struct VteBgPrivate {
 	GList *cache;
 };
 
+struct VteBgCacheItem {
+	enum VteBgSourceType source_type;
+	GdkPixbuf *source_pixbuf;
+	char *source_file;
+
+	GdkColor tint_color;
+	double saturation;
+
+	GdkPixmap *pixmap;
+	GdkPixbuf *pixbuf;
+};
+
+
 static void vte_bg_set_root_pixmap(VteBg *bg, GdkPixmap *pixmap);
-static void vte_bg_init(VteBg *bg, gpointer *klass);
 static GdkPixbuf *_vte_bg_resize_pixbuf(GdkPixbuf *pixbuf,
 					gint min_width, gint min_height);
+static void vte_bg_cache_item_free(struct VteBgCacheItem *item);
 
 #if 0
 static const char *
@@ -73,7 +88,7 @@ static struct VteBgNative *
 vte_bg_native_new(GdkWindow *window)
 {
 	struct VteBgNative *pvt;
-	pvt = g_malloc0(sizeof(struct VteBgNative));
+	pvt = g_slice_new(struct VteBgNative);
 	pvt->window = window;
 	pvt->native_window = gdk_x11_drawable_get_xid(window);
 	pvt->display = gdk_drawable_get_display(GDK_DRAWABLE(window));
@@ -187,10 +202,31 @@ vte_bg_root_pixmap(VteBg *bg)
 }
 #endif
 
+
 static void
-vte_bg_class_init(VteBgClass *klass, gpointer data)
+vte_bg_finalize (GObject *obj)
 {
+	VteBg *bg;
+
+	bg = VTE_BG (obj);
+
+	if (bg->pvt->cache) {
+		g_list_foreach (bg->pvt->cache, (GFunc)vte_bg_cache_item_free, NULL);
+		g_list_free (bg->pvt->cache);
+	}
+
+	G_OBJECT_CLASS(vte_bg_parent_class)->finalize (obj);
+}
+
+static void
+vte_bg_class_init(VteBgClass *klass)
+{
+	GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+
 	bindtextdomain(PACKAGE, LOCALEDIR);
+
+	gobject_class->finalize = vte_bg_finalize;
+
 	klass->root_pixmap_changed = g_signal_new("root-pixmap-changed",
 						  G_OBJECT_CLASS_TYPE(klass),
 						  G_SIGNAL_RUN_LAST,
@@ -199,35 +235,13 @@ vte_bg_class_init(VteBgClass *klass, gpo
 						  NULL,
 						  _vte_marshal_VOID__VOID,
 						  G_TYPE_NONE, 0);
+	g_type_class_add_private(klass, sizeof (struct VteBgPrivate));
 }
 
-GType
-vte_bg_get_type(void)
+static void
+vte_bg_init(VteBg *bg)
 {
-	static GType bg_type = 0;
-	static GTypeInfo bg_type_info = {
-		sizeof(VteBgClass),
-
-		(GBaseInitFunc)NULL,
-		(GBaseFinalizeFunc)NULL,
-
-		(GClassInitFunc)vte_bg_class_init,
-		(GClassFinalizeFunc)NULL,
-		NULL,
-
-		sizeof(VteBg),
-		0,
-		(GInstanceInitFunc) vte_bg_init,
-
-		(const GTypeValueTable *) NULL,
-	};
-	if (bg_type == 0) {
-		bg_type = g_type_register_static(G_TYPE_OBJECT,
-						     "VteBg",
-						     &bg_type_info,
-						     0);
-	}
-	return bg_type;
+	bg->pvt = G_TYPE_INSTANCE_GET_PRIVATE (bg, VTE_TYPE_BG, struct VteBgPrivate);
 }
 
 /**
@@ -249,15 +263,14 @@ vte_bg_get_for_screen(GdkScreen *screen)
 	bg = g_object_get_data(G_OBJECT(screen), "vte-bg");
 	if (G_UNLIKELY(bg == NULL)) {
 		bg = g_object_new(VTE_TYPE_BG, NULL);
-		g_object_set_data(G_OBJECT(screen), "vte-bg", bg);
+		g_object_set_data_full(G_OBJECT(screen),
+			 	"vte-bg", bg, (GDestroyNotify)g_object_unref);
 
 		/* connect bg to screen */
 		bg->screen = screen;
 		window = gdk_screen_get_root_window(screen);
 		bg->native = vte_bg_native_new(window);
 		bg->root_pixmap = vte_bg_root_pixmap(bg);
-		bg->pvt = g_malloc0(sizeof(struct VteBgPrivate));
-		bg->pvt->cache = NULL;
 		events = gdk_window_get_events(window);
 		events |= GDK_PROPERTY_CHANGE_MASK;
 		gdk_window_set_events(window, events);
@@ -267,23 +280,6 @@ vte_bg_get_for_screen(GdkScreen *screen)
 	return bg;
 }
 
-struct VteBgCacheItem {
-	enum VteBgSourceType source_type;
-	GdkPixbuf *source_pixbuf;
-	char *source_file;
-
-	GdkColor tint_color;
-	double saturation;
-
-	GdkPixmap *pixmap;
-	GdkPixbuf *pixbuf;
-};
-
-static void
-vte_bg_init(VteBg *bg, gpointer *klass)
-{
-}
-
 /* Generate lookup tables for desaturating an image toward a given color.  The
  * saturation value is a floating point number between 0 and 1. */
 static void
@@ -332,49 +328,49 @@ vte_bg_colors_equal(const GdkColor *a, c
 }
 
 static void
+vte_bg_cache_item_free(struct VteBgCacheItem *item)
+{
+	/* Clean up whatever is left in the structure. */
+	if (item->source_pixbuf != NULL) {
+		g_object_remove_weak_pointer(G_OBJECT(item->source_pixbuf),
+				(gpointer*)&item->source_pixbuf);
+		item->source_pixbuf = NULL;
+	}
+	if (item->source_file != NULL) {
+		g_free(item->source_file);
+		item->source_file = NULL;
+	}
+	if (item->pixmap != NULL) {
+		g_object_remove_weak_pointer(G_OBJECT(item->pixmap),
+				(gpointer*)&item->pixmap);
+		item->pixmap = NULL;
+	}
+	if (item->pixbuf != NULL) {
+		g_object_remove_weak_pointer(G_OBJECT(item->pixbuf),
+				(gpointer*)&item->pixbuf);
+		item->pixbuf = NULL;
+	}
+
+	g_slice_free(struct VteBgCacheItem, item);
+}
+
+static void
 vte_bg_cache_prune_int(VteBg *bg, gboolean root)
 {
-	GList *i;
-	struct VteBgCacheItem *item;
-	GList *removals = NULL;
-	i = 0;
-	for (i = bg->pvt->cache; i != NULL; i = g_list_next(i)) {
-		item = i->data;
+	GList *i, *next;
+	for (i = bg->pvt->cache; i != NULL; i = next) {
+		struct VteBgCacheItem *item = i->data;
+		next = g_list_next (i);
 		/* Prune the item if either
 		 * it is a "root pixmap" item and we want to prune them, or
 		 * its pixmap and pixbuf fields are both NULL because whichever
 		 * object it created has been destroyoed. */
 		if ((root && (item->source_type == VTE_BG_SOURCE_ROOT)) ||
 		    ((item->pixmap == NULL) && (item->pixbuf == NULL))) {
-			/* Clean up whatever is left in the structure. */
-			if (G_IS_OBJECT(item->source_pixbuf)) {
-				g_object_remove_weak_pointer(G_OBJECT(item->source_pixbuf),
-							     (gpointer*)&item->source_pixbuf);
-			}
-			item->source_pixbuf = NULL;
-			if (item->source_file) {
-				g_free(item->source_file);
-			}
-			item->source_file = NULL;
-			if (G_IS_OBJECT(item->pixmap)) {
-				g_object_remove_weak_pointer(G_OBJECT(item->pixmap),
-							     (gpointer*)&item->pixmap);
-			}
-			item->pixmap = NULL;
-			if (G_IS_OBJECT(item->pixbuf)) {
-				g_object_remove_weak_pointer(G_OBJECT(item->pixbuf),
-							     (gpointer*)&item->pixbuf);
-			}
-			item->pixbuf = NULL;
-			removals = g_list_prepend(removals, i->data);
+			vte_bg_cache_item_free (item);
+			g_list_delete_link(i, i);
 		}
 	}
-	if (removals != NULL) {
-		for (i = removals; i != NULL; i = g_list_next(i)) {
-			bg->pvt->cache = g_list_remove(bg->pvt->cache, i->data);
-		}
-		g_list_free(removals);
-	}
 }
 
 static void
@@ -403,10 +399,6 @@ _vte_bg_resize_pixbuf(GdkPixbuf *pixbuf,
 	gint dst_width, dst_height;
 	gint x, y;
 
-	if (!GDK_IS_PIXBUF(pixbuf)) {
-		return pixbuf;
-	}
-
 	src_width = gdk_pixbuf_get_width(pixbuf);
 	src_height = gdk_pixbuf_get_height(pixbuf);
 	dst_width = (((min_width - 1) / src_width) + 1) * src_width;
@@ -435,14 +427,14 @@ #endif
 		}
 	}
 
-	g_object_unref(G_OBJECT(pixbuf));
+	g_object_unref(pixbuf);
 	return tmp;
 }
 
 static void
 vte_bg_set_root_pixmap(VteBg *bg, GdkPixmap *pixmap)
 {
-	if (GDK_IS_PIXMAP(bg->root_pixmap)) {
+	if (bg->root_pixmap != NULL) {
 		g_object_unref(bg->root_pixmap);
 	}
 	bg->root_pixmap = pixmap;
@@ -457,15 +449,15 @@ vte_bg_cache_add(VteBg *bg, struct VteBg
 {
 	vte_bg_cache_prune(bg);
 	bg->pvt->cache = g_list_prepend(bg->pvt->cache, item);
-	if (G_IS_OBJECT(item->source_pixbuf)) {
+	if (item->source_pixbuf != NULL) {
 		g_object_add_weak_pointer(G_OBJECT(item->source_pixbuf),
 					  (gpointer*)&item->source_pixbuf);
 	}
-	if (G_IS_OBJECT(item->pixbuf)) {
+	if (item->pixbuf != NULL) {
 		g_object_add_weak_pointer(G_OBJECT(item->pixbuf),
 					  (gpointer*)&item->pixbuf);
 	}
-	if (G_IS_OBJECT(item->pixmap)) {
+	if (item->pixmap != NULL) {
 		g_object_add_weak_pointer(G_OBJECT(item->pixmap),
 					  (gpointer*)&item->pixmap);
 	}
@@ -510,7 +502,7 @@ vte_bg_desaturate_pixbuf(GdkPixbuf *pixb
 
 /* Search for a match in the cache, and if found, return an object with an
    additional ref. */
-static GObject *
+static gpointer
 vte_bg_cache_search(VteBg *bg,
 		    enum VteBgSourceType source_type,
 		    const GdkPixbuf *source_pixbuf,
@@ -520,14 +512,13 @@ vte_bg_cache_search(VteBg *bg,
 		    gboolean pixbuf,
 		    gboolean pixmap)
 {
-	struct VteBgCacheItem *item;
 	GList *i;
 
 	g_assert((pixmap && !pixbuf) || (!pixmap && pixbuf));
-	vte_bg_cache_prune(bg);
 
+	vte_bg_cache_prune(bg);
 	for (i = bg->pvt->cache; i != NULL; i = g_list_next(i)) {
-		item = i->data;
+		struct VteBgCacheItem *item = i->data;
 		if (vte_bg_colors_equal(&item->tint_color, tint) &&
 		    (saturation == item->saturation) &&
 		    (source_type == item->source_type)) {
@@ -548,13 +539,11 @@ vte_bg_cache_search(VteBg *bg,
 				g_assert_not_reached();
 				break;
 			}
-			if (pixbuf && GDK_IS_PIXBUF(item->pixbuf)) {
-				g_object_ref(G_OBJECT(item->pixbuf));
-				return G_OBJECT(item->pixbuf);
+			if (pixbuf && item->pixbuf != NULL) {
+				return g_object_ref(item->pixbuf);
 			}
-			if (pixmap && GDK_IS_PIXMAP(item->pixmap)) {
-				g_object_ref(G_OBJECT(item->pixmap));
-				return G_OBJECT(item->pixmap);
+			if (pixmap && item->pixmap != NULL) {
+				return g_object_ref(item->pixmap);
 			}
 		}
 	}
@@ -571,7 +560,7 @@ vte_bg_get_pixmap(VteBg *bg,
 		  GdkColormap *colormap)
 {
 	struct VteBgCacheItem *item;
-	GObject *cached;
+	gpointer cached;
 	GdkColormap *rcolormap;
 	GdkPixmap *pixmap;
 	GdkBitmap *mask;
@@ -585,11 +574,11 @@ vte_bg_get_pixmap(VteBg *bg,
 	cached = vte_bg_cache_search(bg, source_type,
 				     source_pixbuf, source_file,
 				     tint, saturation, FALSE, TRUE);
-	if (G_IS_OBJECT(cached) && GDK_IS_PIXMAP(cached)) {
-		return GDK_PIXMAP(cached);
+	if (cached != NULL) {
+		return cached;
 	}
 
-	item = g_malloc0(sizeof(struct VteBgCacheItem));
+	item = g_slice_new(struct VteBgCacheItem);
 	item->source_type = source_type;
 	item->source_pixbuf = NULL;
 	item->source_file = NULL;
@@ -638,7 +627,7 @@ vte_bg_get_pixmap(VteBg *bg,
 	case VTE_BG_SOURCE_PIXBUF:
 		pixbuf = source_pixbuf;
 		if (GDK_IS_PIXBUF(pixbuf)) {
-			g_object_ref(G_OBJECT(pixbuf));
+			g_object_ref(pixbuf);
 		}
 		break;
 	case VTE_BG_SOURCE_FILE:
@@ -654,7 +643,7 @@ vte_bg_get_pixmap(VteBg *bg,
 
 	item->source_pixbuf = source_pixbuf;
 	if (G_IS_OBJECT(item->source_pixbuf)) {
-		g_object_ref(G_OBJECT(item->source_pixbuf));
+		g_object_ref(item->source_pixbuf);
 	}
 	item->source_file = file;
 
@@ -676,10 +665,10 @@ vte_bg_get_pixmap(VteBg *bg,
 							       colormap,
 							       &pixmap, &mask,
 							       0);
-		if (G_IS_OBJECT(mask)) {
-			g_object_unref(G_OBJECT(mask));
+		if (mask != NULL) {
+			g_object_unref(mask);
 		}
-		g_object_unref(G_OBJECT(pixbuf));
+		g_object_unref(pixbuf);
 	}
 
 	item->pixmap = pixmap;
@@ -698,7 +687,7 @@ vte_bg_get_pixbuf(VteBg *bg,
 		  double saturation)
 {
 	struct VteBgCacheItem *item;
-	GObject *cached;
+	gpointer cached;
 	GdkPixbuf *pixbuf;
 	GdkColormap *rcolormap;
 	char *file;
@@ -710,11 +699,11 @@ vte_bg_get_pixbuf(VteBg *bg,
 	cached = vte_bg_cache_search(bg, source_type,
 				     source_pixbuf, source_file,
 				     tint, saturation, TRUE, FALSE);
-	if (G_IS_OBJECT(cached) && GDK_IS_PIXBUF(cached)) {
-		return GDK_PIXBUF(cached);
+	if (cached != NULL) {
+		return cached;
 	}
 
-	item = g_malloc0(sizeof(struct VteBgCacheItem));
+	item = g_slice_new(struct VteBgCacheItem);
 	item->source_type = source_type;
 	item->source_pixbuf = NULL;
 	item->source_file = NULL;
@@ -762,7 +751,7 @@ vte_bg_get_pixbuf(VteBg *bg,
 	case VTE_BG_SOURCE_PIXBUF:
 		pixbuf = source_pixbuf;
 		if (G_IS_OBJECT(pixbuf)) {
-			g_object_ref(G_OBJECT(pixbuf));
+			g_object_ref(pixbuf);
 		}
 		break;
 	case VTE_BG_SOURCE_FILE:
@@ -781,7 +770,7 @@ vte_bg_get_pixbuf(VteBg *bg,
 
 	if (GDK_IS_PIXBUF(item->source_pixbuf)) {
 		if (saturation == 1.0) {
-			g_object_ref(G_OBJECT(item->source_pixbuf));
+			g_object_ref(item->source_pixbuf);
 			item->pixbuf = item->source_pixbuf;
 		} else {
 			item->pixbuf = gdk_pixbuf_copy(item->source_pixbuf);
