diff --git a/include/kernel/sched.h b/include/kernel/sched.h
index a60ceac49b613bf52eaa296854fbebed4600fadf..160b92e9daf40fdfce8668540f860da5f47ef9d5 100644
--- a/include/kernel/sched.h
+++ b/include/kernel/sched.h
@@ -6,8 +6,10 @@
 #ifndef _KERNEL_SCHED_H_
 #define _KERNEL_SCHED_H_
 
-#include <generated/autoconf.h>	/*XXX */
+#include <list.h>
+#include <kernel/time.h>
 
+#include <generated/autoconf.h>	/*XXX */
 
 /* scheduler priority levels */
 #define SCHED_PRIORITY_RR	0
@@ -114,8 +116,6 @@ void switch_to(struct task_struct *next);
 void schedule(void);
 void sched_yield(void);
 
-void sched_print_edf_list(void);
-
 
 int sched_set_attr(struct task_struct *task, struct sched_attr *attr);
 int sched_get_attr(struct task_struct *task, struct sched_attr *attr);
diff --git a/init/main.c b/init/main.c
index eb3bb2f86e414c7c92dc083d706fe86788ffd2c6..7feda9a8f35a478edb485bb243745e2c5aaf2b0c 100644
--- a/init/main.c
+++ b/init/main.c
@@ -46,6 +46,8 @@
 #endif /* __OPTIMIZE__ */
 #endif /* GCC_VERSION */
 
+/** XXX dummy **/
+extern int cpu_ready[CONFIG_SMP_CPUS_MAX];
 
 /**
  * @brief kernel initialisation routines
@@ -63,74 +65,16 @@ static int kernel_init(void)
 arch_initcall(kernel_init);
 
 
-
-/** XXX dummy **/
-extern int cpu1_ready;
-
-
-volatile int xp;
-int task1(void *p)
-{
-	while (1) {
-		xp++;
-	}
-}
-
-volatile int xd;
-int task2(void *p)
-{
-	while (1)
-		xd++;
-}
-
-int task(void *p)
-{
-	char buf1[64];
-	char buf2[64];
-	char buf3[64];
-
-	struct sysobj *sys_irq = NULL;
-
-
-	sys_irq = sysset_find_obj(sys_set, "/sys/irl/primary");
-
-	if (!sys_irq) {
-		printk("Error locating sysctl entry\n");
-		return -1;
-	}
-
-	while (1) {
-
-		sysobj_show_attr(sys_irq, "irl", buf1);
-		sysobj_show_attr(sys_irq, "8", buf2);
-		sysobj_show_attr(sys_irq, "9", buf3);
-
-		printk("IRQ total: %s timer1: %s timer2: %s, %d %d\n",
-		       buf1, buf2, buf3, ioread32be(&xp), xd);
-
-		sched_yield();
-	}
-
-	return 0;
-}
-
-
-
-/** XXX dummy **/
-extern int cpu_ready[CONFIG_SMP_CPUS_MAX];
 /**
  * @brief kernel main functionputchar( *((char *) data) );
  */
 int kernel_main(void)
 {
 	int i;
-	struct task_struct *t;
-	struct sched_attr attr;
 
-#if 0
-	void *addr;
-	struct elf_module m;
-#endif
+	void *addr __attribute__((unused));
+	struct elf_module m __attribute__((unused));
+
 
 	printk(MSG "Loading module image\n");
 
@@ -164,26 +108,6 @@ int kernel_main(void)
 #endif
 
 
-#ifdef CONFIG_EMBED_APPLICATION
-	/* dummy demonstrator */
-{
-	void *addr;
-	struct elf_module m;
-
-	addr = module_read_embedded("CrApp1");
-
-	pr_debug(MSG "test executable address is %p\n", addr);
-	if (addr)
-		module_load(&m, addr);
-
-#if 0
-	modules_list_loaded();
-#endif
-}
-#endif
-
-
-
 #ifdef CONFIG_MPPB
 	/* The mppbv2 LEON's cache would really benefit from cache sniffing...
 	 * Interactions with DMA or Xentiums are a pain when using the lower
@@ -217,52 +141,19 @@ int kernel_main(void)
 
 	printk(MSG "Boot complete\n");
 
+#ifdef CONFIG_EMBED_APPLICATION
+	/* dummy demonstrator */
+
+	addr = module_read_embedded("executable_demo");
 
-	t = kthread_create(task, NULL, KTHREAD_CPU_AFFINITY_NONE, "task");
-	if (!IS_ERR(t)) {
-		sched_get_attr(t, &attr);
-		attr.policy = SCHED_EDF;
-		attr.period       = ms_to_ktime(1000);
-		attr.deadline_rel = ms_to_ktime(999);
-		attr.wcet         = ms_to_ktime(300);
-		sched_set_attr(t, &attr);
-		if (kthread_wake_up(t) < 0)
-			printk("---- %s NOT SCHEDUL-ABLE---\n", t->name);
-	} else {
-		printk("Got an error in kthread_create!");
-	}
-	printk("%s runs on CPU %d\n", t->name, t->on_cpu);
-
-	t = kthread_create(task1, NULL, KTHREAD_CPU_AFFINITY_NONE, "task1");
-	if (!IS_ERR(t)) {
-		sched_get_attr(t, &attr);
-		attr.policy = SCHED_EDF;
-		attr.period       = us_to_ktime(300);
-		attr.deadline_rel = us_to_ktime(200);
-		attr.wcet         = us_to_ktime(100);
-		sched_set_attr(t, &attr);
-		if (kthread_wake_up(t) < 0)
-			printk("---- %s NOT SCHEDUL-ABLE---\n", t->name);
-	} else {
-		printk("Got an error in kthread_create!");
-	}
-	printk("%s runs on CPU %d\n", t->name, t->on_cpu);
-
-
-	t = kthread_create(task2, NULL, KTHREAD_CPU_AFFINITY_NONE, "task2");
-	if (!IS_ERR(t)) {
-		sched_get_attr(t, &attr);
-		attr.policy = SCHED_EDF;
-		attr.period       = us_to_ktime(300);
-		attr.deadline_rel = us_to_ktime(200);
-		attr.wcet         = us_to_ktime(100);
-		sched_set_attr(t, &attr);
-		if (kthread_wake_up(t) < 0)
-			printk("---- %s NOT SCHEDUL-ABLE---\n", t->name);
-	} else {
-		printk("Got an error in kthread_create!");
-	}
-	printk("%s runs on CPU %d\n", t->name, t->on_cpu);
+	pr_debug(MSG "test executable address is %p\n", addr);
+	if (addr)
+		module_load(&m, addr);
+
+#if 0
+	modules_list_loaded();
+#endif
+#endif
 
 
 	while(1)
diff --git a/kernel/kthread.c b/kernel/kthread.c
index 0b42a266e2b26dc74fae6822c4a82fc8c3f79388..c86697f0ec9b7478e047c0b0d0da67f0346ee8cf 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -50,6 +50,20 @@ static void kthread_unlock(void)
 }
 
 
+void kthread_set_sched_edf(struct task_struct *task, unsigned long period_us,
+			   unsigned long wcet_us, unsigned long deadline_rel_us)
+{
+	struct sched_attr attr;
+	sched_get_attr(task, &attr);
+	attr.policy = SCHED_EDF;
+	attr.period       = us_to_ktime(period_us);
+	attr.deadline_rel = us_to_ktime(wcet_us);
+	attr.wcet         = us_to_ktime(deadline_rel_us);
+	sched_set_attr(task, &attr);
+}
+
+
+
 /* we should have a thread with a semaphore which is unlocked by schedule()
  * if dead tasks were added to the "dead" list
  */
diff --git a/lib/string.c b/lib/string.c
index 2cf71210ef721e6d7a298b7dd0313c26ed77369d..4f960f3736b630872abc69ea5414995d0aaae7da 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -462,8 +462,14 @@ EXPORT_SYMBOL(puts);
 int putchar(int c)
 {
 #define TREADY 4
+
+#if defined(CONFIG_LEON3)
 	static volatile int *console = (int *)0x80000100;
+#endif
 
+#if defined(CONFIG_LEON4)
+	static volatile int *console = (int *)0xFF900000;
+#endif
 	while (!(console[1] & TREADY));
 
 	console[0] = 0x0ff & c;
@@ -479,6 +485,7 @@ int putchar(int c)
 
 
 
+
 /**
  * @brief print a string into a buffer
  *
diff --git a/lib/vsnprintf.c b/lib/vsnprintf.c
index fd9fee8553b49b20c0f93571a824fae8020ec07c..89a3985ff018149306998e87c4ef733a57ab4595 100644
--- a/lib/vsnprintf.c
+++ b/lib/vsnprintf.c
@@ -58,32 +58,6 @@ struct fmt_spec {
 
 
 
-#define TREADY 4
-
-#if defined(CONFIG_LEON3)
-static volatile int *console = (int *)0x80000100;
-#endif
-
-#if defined(CONFIG_LEON4)
-static volatile int *console = (int *)0xFF900000;
-#endif
-
-static int putchar(int c)
-{
-	while (!(console[1] & TREADY));
-
-	console[0] = 0x0ff & c;
-
-	if (c == '\n') {
-		while (!(console[1] & TREADY));
-		console[0] = (int) '\r';
-	}
-
-	return c;
-}
-
-
-
 /**
  * @brief print a single character
  *