diff --git a/boards/avsextrem/drivers/avsextrem-smb380.c b/boards/avsextrem/drivers/avsextrem-smb380.c
index b5b4a981bef17f90e2ebd64ecfcbc7f1eef0c08f..017f78249da1dbb822ba1d4d6fa266ddfa190f14 100644
--- a/boards/avsextrem/drivers/avsextrem-smb380.c
+++ b/boards/avsextrem/drivers/avsextrem-smb380.c
@@ -173,7 +173,7 @@ uint8_t SMB380_init_simple(uint16_t samplerate, uint8_t bandwidth, uint8_t
 {
     SSP0Init();
     interruptTicksSMB380 = 0;
-    simple_pid = active_thread->pid;
+    simple_pid = sched_active_thread->pid;
     gpioint_set(0, BIT1, GPIOINT_RISING_EDGE, &SMB380_simple_interrupthandler);
     SMB380_softReset();
     hwtimer_wait(HWTIMER_TICKS(100000));
@@ -305,7 +305,7 @@ uint8_t getRingReadPointerforCurrentThread(void)
 {
     uint8_t pointerNo = 0;
 
-    while ((PointerList[pointerNo] != active_thread->pid) &&
+    while ((PointerList[pointerNo] != sched_active_thread->pid) &&
            (pointerNo < SMB380_RING_BUFF_MAX_THREADS)) {
         pointerNo++;
     }
@@ -327,7 +327,7 @@ uint8_t initRingReadPointerforCurrentThread(void)
         return 0;
     }
     else {
-        PointerList[pointerNo] = active_thread->pid;
+        PointerList[pointerNo] = sched_active_thread->pid;
         readPointerPos[pointerNo] = settings.writePointerPos;
         return 1;
     }
diff --git a/core/bitarithm.c b/core/bitarithm.c
index dbd17ffeafc15842537b421e000247a5144ae1e8..774037ba435f8316bc4288bef5684833c277370c 100644
--- a/core/bitarithm.c
+++ b/core/bitarithm.c
@@ -21,8 +21,7 @@
 
 #include <stdio.h>
 
-unsigned
-number_of_highest_bit(unsigned v)
+unsigned bitarithm_msb(unsigned v)
 {
     register unsigned r; // result of log2(v) will go here
 
@@ -45,8 +44,7 @@ number_of_highest_bit(unsigned v)
     return r;
 }
 /*---------------------------------------------------------------------------*/
-unsigned
-number_of_lowest_bit(register unsigned v)
+unsigned bitarithm_lsb(register unsigned v)
 {
     register unsigned r = 0;
 
@@ -58,8 +56,7 @@ number_of_lowest_bit(register unsigned v)
     return r;
 }
 /*---------------------------------------------------------------------------*/
-unsigned
-number_of_bits_set(unsigned v)
+unsigned bitarithm_bits_set(unsigned v)
 {
     unsigned c; // c accumulates the total bits set in v
 
diff --git a/core/include/bitarithm.h b/core/include/bitarithm.h
index 673e5dff86da302193084ee198958178cca4f384..696f68e71e2f5323da53d0af022111ebc0fc0b46 100644
--- a/core/include/bitarithm.h
+++ b/core/include/bitarithm.h
@@ -94,7 +94,7 @@
  *
  * Source: http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious
  */
-unsigned number_of_highest_bit(unsigned v);
+unsigned bitarithm_msb(unsigned v);
 
 /**
  * @brief   Returns the number of the lowest '1' bit in a value
@@ -104,7 +104,7 @@ unsigned number_of_highest_bit(unsigned v);
  *
  * Source: http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious
  */
-unsigned number_of_lowest_bit(register unsigned v);
+unsigned bitarithm_lsb(register unsigned v);
 
 /**
  * @brief   Returns the number of bits set in a value
@@ -113,7 +113,7 @@ unsigned number_of_lowest_bit(register unsigned v);
  *
  * Source: http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious
  */
-unsigned number_of_bits_set(unsigned v);
+unsigned bitarithm_bits_set(unsigned v);
 
 #endif /* BITARITHM_H_ */
 /** @} */
diff --git a/core/include/debug.h b/core/include/debug.h
index 4fcf4f3103ef77f181c2191263f9483fbe8f2325..f3c8397f1bb0a13f6c8f9786426d1e298ee70305 100644
--- a/core/include/debug.h
+++ b/core/include/debug.h
@@ -39,7 +39,7 @@
 #include "cpu-conf.h"
 #define DEBUG_PRINT(...) \
     do { \
-        if ((active_thread == NULL) || (active_thread->stack_size > KERNEL_CONF_STACKSIZE_PRINTF)) { \
+        if ((sched_active_thread == NULL) || (sched_active_thread->stack_size > KERNEL_CONF_STACKSIZE_PRINTF)) { \
             printf(__VA_ARGS__); \
         } \
         else { \
@@ -70,7 +70,7 @@
 #define DEBUGF(...) \
     do { \
         DEBUG_PRINT("DEBUG(%s): %s:%d in %s: ", \
-                active_thread ? active_thread->name : "NO THREAD", \
+                sched_active_thread ? sched_active_thread->name : "NO THREAD", \
                 __FILE__, __LINE__, __func__); \
         DEBUG_PRINT(__VA_ARGS__); \
     } while (0)
diff --git a/core/include/sched.h b/core/include/sched.h
index 7d813084b7680ba5c8be115eb3170002e12f8543..78b8604c5e183ea4fd3de6af6686996f0e253367 100644
--- a/core/include/sched.h
+++ b/core/include/sched.h
@@ -82,17 +82,17 @@ extern volatile tcb_t *sched_threads[MAXTHREADS];
 /**
  *  Currently active thread
  */
-extern volatile tcb_t *active_thread;
+extern volatile tcb_t *sched_active_thread;
 
 /**
  *  Number of running (non-terminated) threads
  */
-extern volatile int num_tasks;
+extern volatile int sched_num_threads;
 
 /**
  *  Process ID of active thread
  */
-extern volatile int thread_pid;
+extern volatile int sched_active_pid;
 
 /**
  *  Process ID of the thread that was active before the current one
diff --git a/core/include/thread.h b/core/include/thread.h
index 8f9663e35773a99acc8730ca7103362e6b811f22..a2df2163f998495f6f3d32bf8d9221cd7fb4685d 100644
--- a/core/include/thread.h
+++ b/core/include/thread.h
@@ -142,7 +142,7 @@ int thread_getlastpid(void);
  *
  * Only works if the thread was created with the flag CREATE_STACKTEST.
  *
- * @param[in] stack the stack you want to measure. try `active_thread->stack_start`
+ * @param[in] stack the stack you want to measure. try `sched_active_thread->stack_start`
  *
  * @return          the amount of unused space of the thread's stack
  */
diff --git a/core/msg.c b/core/msg.c
index 0fd4965e3ea7818a61b21d34fad02af653f23e85..93a34ca98538b28b293a0c71b09b8ad8502b2430 100644
--- a/core/msg.c
+++ b/core/msg.c
@@ -60,7 +60,7 @@ int msg_send(msg_t *m, unsigned int target_pid, bool block)
 
     tcb_t *target = (tcb_t*) sched_threads[target_pid];
 
-    m->sender_pid = thread_pid;
+    m->sender_pid = sched_active_pid;
 
     if (m->sender_pid == target_pid) {
         return msg_send_to_self(m);
@@ -72,51 +72,51 @@ int msg_send(msg_t *m, unsigned int target_pid, bool block)
 
     dINT();
 
-    DEBUG("msg_send() %s:%i: Sending from %i to %i. block=%i src->state=%i target->state=%i\n", __FILE__, __LINE__, thread_pid, target_pid, block, active_thread->status, target->status);
+    DEBUG("msg_send() %s:%i: Sending from %i to %i. block=%i src->state=%i target->state=%i\n", __FILE__, __LINE__, sched_active_pid, target_pid, block, sched_active_thread->status, target->status);
 
     if (target->status != STATUS_RECEIVE_BLOCKED) {
         DEBUG("msg_send() %s:%i: Target %i is not RECEIVE_BLOCKED.\n", __FILE__, __LINE__, target_pid);
         if (target->msg_array && queue_msg(target, m)) {
             DEBUG("msg_send() %s:%i: Target %i has a msg_queue. Queueing message.\n", __FILE__, __LINE__, target_pid);
             eINT();
-            if (active_thread->status == STATUS_REPLY_BLOCKED) {
+            if (sched_active_thread->status == STATUS_REPLY_BLOCKED) {
                 thread_yield();
             }
             return 1;
         }
 
         if (!block) {
-            DEBUG("msg_send: %s: Receiver not waiting, block=%u\n", active_thread->name, block);
+            DEBUG("msg_send: %s: Receiver not waiting, block=%u\n", sched_active_thread->name, block);
             eINT();
             return 0;
         }
 
-        DEBUG("msg_send: %s: send_blocked.\n", active_thread->name);
+        DEBUG("msg_send: %s: send_blocked.\n", sched_active_thread->name);
         queue_node_t n;
-        n.priority = active_thread->priority;
-        n.data = (unsigned int) active_thread;
+        n.priority = sched_active_thread->priority;
+        n.data = (unsigned int) sched_active_thread;
         n.next = NULL;
-        DEBUG("msg_send: %s: Adding node to msg_waiters:\n", active_thread->name);
+        DEBUG("msg_send: %s: Adding node to msg_waiters:\n", sched_active_thread->name);
 
         queue_priority_add(&(target->msg_waiters), &n);
 
-        active_thread->wait_data = (void*) m;
+        sched_active_thread->wait_data = (void*) m;
 
         int newstatus;
 
-        if (active_thread->status == STATUS_REPLY_BLOCKED) {
+        if (sched_active_thread->status == STATUS_REPLY_BLOCKED) {
             newstatus = STATUS_REPLY_BLOCKED;
         }
         else {
             newstatus = STATUS_SEND_BLOCKED;
         }
 
-        sched_set_status((tcb_t*) active_thread, newstatus);
+        sched_set_status((tcb_t*) sched_active_thread, newstatus);
 
-        DEBUG("msg_send: %s: Back from send block.\n", active_thread->name);
+        DEBUG("msg_send: %s: Back from send block.\n", sched_active_thread->name);
     }
     else {
-        DEBUG("msg_send: %s: Direct msg copy from %i to %i.\n", active_thread->name, thread_getpid(), target_pid);
+        DEBUG("msg_send: %s: Direct msg copy from %i to %i.\n", sched_active_thread->name, thread_getpid(), target_pid);
         /* copy msg to target */
         msg_t *target_message = (msg_t*) target->wait_data;
         *target_message = *m;
@@ -133,7 +133,7 @@ int msg_send_to_self(msg_t *m)
 {
     unsigned int state = disableIRQ();
 
-    int res = queue_msg((tcb_t *) active_thread, m);
+    int res = queue_msg((tcb_t *) sched_active_thread, m);
 
     restoreIRQ(state);
     return res;
@@ -165,7 +165,7 @@ int msg_send_int(msg_t *m, unsigned int target_pid)
 int msg_send_receive(msg_t *m, msg_t *reply, unsigned int target_pid)
 {
     dINT();
-    tcb_t *me = (tcb_t*) sched_threads[thread_pid];
+    tcb_t *me = (tcb_t*) sched_threads[sched_active_pid];
     sched_set_status(me, STATUS_REPLY_BLOCKED);
     me->wait_data = (void*) reply;
 
@@ -181,17 +181,17 @@ int msg_reply(msg_t *m, msg_t *reply)
     tcb_t *target = (tcb_t*) sched_threads[m->sender_pid];
 
     if (!target) {
-        DEBUG("msg_reply(): %s: Target \"%" PRIu16 "\" not existing...dropping msg!\n", active_thread->name, m->sender_pid);
+        DEBUG("msg_reply(): %s: Target \"%" PRIu16 "\" not existing...dropping msg!\n", sched_active_thread->name, m->sender_pid);
         return -1;
     }
 
     if (target->status != STATUS_REPLY_BLOCKED) {
-        DEBUG("msg_reply(): %s: Target \"%s\" not waiting for reply.", active_thread->name, target->name);
+        DEBUG("msg_reply(): %s: Target \"%s\" not waiting for reply.", sched_active_thread->name, target->name);
         restoreIRQ(state);
         return -1;
     }
 
-    DEBUG("msg_reply(): %s: Direct msg copy.\n", active_thread->name);
+    DEBUG("msg_reply(): %s: Direct msg copy.\n", sched_active_thread->name);
     /* copy msg to target */
     msg_t *target_message = (msg_t*) target->wait_data;
     *target_message = *reply;
@@ -207,7 +207,7 @@ int msg_reply_int(msg_t *m, msg_t *reply)
     tcb_t *target = (tcb_t*) sched_threads[m->sender_pid];
 
     if (target->status != STATUS_REPLY_BLOCKED) {
-        DEBUG("msg_reply_int(): %s: Target \"%s\" not waiting for reply.", active_thread->name, target->name);
+        DEBUG("msg_reply_int(): %s: Target \"%s\" not waiting for reply.", sched_active_thread->name, target->name);
         return -1;
     }
 
@@ -231,9 +231,9 @@ int msg_receive(msg_t *m)
 static int _msg_receive(msg_t *m, int block)
 {
     dINT();
-    DEBUG("_msg_receive: %s: _msg_receive.\n", active_thread->name);
+    DEBUG("_msg_receive: %s: _msg_receive.\n", sched_active_thread->name);
 
-    tcb_t *me = (tcb_t*) sched_threads[thread_pid];
+    tcb_t *me = (tcb_t*) sched_threads[sched_active_pid];
 
     int queue_index = -1;
 
@@ -247,7 +247,7 @@ static int _msg_receive(msg_t *m, int block)
     }
 
     if (queue_index >= 0) {
-        DEBUG("_msg_receive: %s: _msg_receive(): We've got a queued message.\n", active_thread->name);
+        DEBUG("_msg_receive: %s: _msg_receive(): We've got a queued message.\n", sched_active_thread->name);
         *m = me->msg_array[queue_index];
     }
     else {
@@ -257,10 +257,10 @@ static int _msg_receive(msg_t *m, int block)
     queue_node_t *node = queue_remove_head(&(me->msg_waiters));
 
     if (node == NULL) {
-        DEBUG("_msg_receive: %s: _msg_receive(): No thread in waiting list.\n", active_thread->name);
+        DEBUG("_msg_receive: %s: _msg_receive(): No thread in waiting list.\n", sched_active_thread->name);
 
         if (queue_index < 0) {
-            DEBUG("_msg_receive(): %s: No msg in queue. Going blocked.\n", active_thread->name);
+            DEBUG("_msg_receive(): %s: No msg in queue. Going blocked.\n", sched_active_thread->name);
             sched_set_status(me, STATUS_RECEIVE_BLOCKED);
 
             eINT();
@@ -272,7 +272,7 @@ static int _msg_receive(msg_t *m, int block)
         return 1;
     }
     else {
-        DEBUG("_msg_receive: %s: _msg_receive(): Waking up waiting thread.\n", active_thread->name);
+        DEBUG("_msg_receive: %s: _msg_receive(): Waking up waiting thread.\n", sched_active_thread->name);
         tcb_t *sender = (tcb_t*) node->data;
 
         if (queue_index >= 0) {
@@ -301,7 +301,7 @@ int msg_init_queue(msg_t *array, int num)
 {
     /* check if num is a power of two by comparing to its complement */
     if (num && (num & (num - 1)) == 0) {
-        tcb_t *me = (tcb_t*) active_thread;
+        tcb_t *me = (tcb_t*) sched_active_thread;
         me->msg_array = array;
         cib_init(&(me->msg_queue), num);
         return 0;
diff --git a/core/mutex.c b/core/mutex.c
index ccded89728672affdcabef52100fa533a7a724ba..29a701e0ec05f7cf376a7020c56067d8b9c4198c 100644
--- a/core/mutex.c
+++ b/core/mutex.c
@@ -48,13 +48,13 @@ int mutex_init(struct mutex_t *mutex)
 
 int mutex_trylock(struct mutex_t *mutex)
 {
-    DEBUG("%s: trylocking to get mutex. val: %u\n", active_thread->name, mutex->val);
+    DEBUG("%s: trylocking to get mutex. val: %u\n", sched_active_thread->name, mutex->val);
     return (atomic_set_return(&mutex->val, 1) == 0);
 }
 
 int mutex_lock(struct mutex_t *mutex)
 {
-    DEBUG("%s: trying to get mutex. val: %u\n", active_thread->name, mutex->val);
+    DEBUG("%s: trying to get mutex. val: %u\n", sched_active_thread->name, mutex->val);
 
     if (atomic_set_return(&mutex->val, 1) != 0) {
         /* mutex was locked. */
@@ -67,24 +67,24 @@ int mutex_lock(struct mutex_t *mutex)
 static void mutex_wait(struct mutex_t *mutex)
 {
     int irqstate = disableIRQ();
-    DEBUG("%s: Mutex in use. %u\n", active_thread->name, mutex->val);
+    DEBUG("%s: Mutex in use. %u\n", sched_active_thread->name, mutex->val);
 
     if (mutex->val == 0) {
         /* somebody released the mutex. return. */
         mutex->val = 1;
-        DEBUG("%s: mutex_wait early out. %u\n", active_thread->name, mutex->val);
+        DEBUG("%s: mutex_wait early out. %u\n", sched_active_thread->name, mutex->val);
         restoreIRQ(irqstate);
         return;
     }
 
-    sched_set_status((tcb_t *) active_thread, STATUS_MUTEX_BLOCKED);
+    sched_set_status((tcb_t*) sched_active_thread, STATUS_MUTEX_BLOCKED);
 
     queue_node_t n;
-    n.priority = (unsigned int) active_thread->priority;
-    n.data = (unsigned int) active_thread;
+    n.priority = (unsigned int) sched_active_thread->priority;
+    n.data = (unsigned int) sched_active_thread;
     n.next = NULL;
 
-    DEBUG("%s: Adding node to mutex queue: prio: %" PRIu32 "\n", active_thread->name, n.priority);
+    DEBUG("%s: Adding node to mutex queue: prio: %" PRIu32 "\n", sched_active_thread->name, n.priority);
 
     queue_priority_add(&(mutex->queue), &n);
 
@@ -97,7 +97,7 @@ static void mutex_wait(struct mutex_t *mutex)
 
 void mutex_unlock(struct mutex_t *mutex)
 {
-    DEBUG("%s: unlocking mutex. val: %u pid: %u\n", active_thread->name, mutex->val, thread_pid);
+    DEBUG("%s: unlocking mutex. val: %u pid: %u\n", sched_active_thread->name, mutex->val, sched_active_pid);
     int irqstate = disableIRQ();
 
     if (mutex->val != 0) {
@@ -107,7 +107,7 @@ void mutex_unlock(struct mutex_t *mutex)
             DEBUG("%s: waking up waiter.\n", process->name);
             sched_set_status(process, STATUS_PENDING);
 
-            sched_switch(active_thread->priority, process->priority);
+            sched_switch(sched_active_thread->priority, process->priority);
         }
         else {
             mutex->val = 0;
@@ -119,7 +119,7 @@ void mutex_unlock(struct mutex_t *mutex)
 
 void mutex_unlock_and_sleep(struct mutex_t *mutex)
 {
-    DEBUG("%s: unlocking mutex. val: %u pid: %u, and taking a nap\n", active_thread->name, mutex->val, thread_pid);
+    DEBUG("%s: unlocking mutex. val: %u pid: %u, and taking a nap\n", sched_active_thread->name, mutex->val, sched_active_pid);
     int irqstate = disableIRQ();
 
     if (mutex->val != 0) {
@@ -133,9 +133,8 @@ void mutex_unlock_and_sleep(struct mutex_t *mutex)
             mutex->val = 0;
         }
     }
-
-    DEBUG("%s: going to sleep.\n", active_thread->name);
-    sched_set_status((tcb_t *) active_thread, STATUS_SLEEPING);
+    DEBUG("%s: going to sleep.\n", sched_active_thread->name);
+    sched_set_status((tcb_t*) sched_active_thread, STATUS_SLEEPING);
     restoreIRQ(irqstate);
     thread_yield();
 }
diff --git a/core/sched.c b/core/sched.c
index 883a72e7547ab242bc327fe2d34211392e151e7d..d72fad8a5d2aad1755e5eebae6c39144f9cedaf9 100644
--- a/core/sched.c
+++ b/core/sched.c
@@ -39,29 +39,29 @@
 #define ENABLE_DEBUG (0)
 #include "debug.h"
 
-volatile int num_tasks = 0;
+volatile int sched_num_threads = 0;
 
 volatile unsigned int sched_context_switch_request;
 
 volatile tcb_t *sched_threads[MAXTHREADS];
-volatile tcb_t *active_thread;
+volatile tcb_t *sched_active_thread;
 
-volatile int thread_pid = -1;
-volatile int last_pid = -1;
+volatile int sched_active_pid = -1;
+volatile int thread_last_pid = -1;
 
-clist_node_t *runqueues[SCHED_PRIO_LEVELS];
+clist_node_t *sched_runqueues[SCHED_PRIO_LEVELS];
 static uint32_t runqueue_bitcache = 0;
 
 #if SCHEDSTATISTICS
 static void (*sched_cb) (uint32_t timestamp, uint32_t value) = NULL;
-schedstat pidlist[MAXTHREADS];
+schedstat sched_pidlist[MAXTHREADS];
 #endif
 
 void sched_run(void)
 {
     sched_context_switch_request = 0;
 
-    tcb_t *my_active_thread = (tcb_t *)active_thread;
+    tcb_t *my_active_thread = (tcb_t *)sched_active_thread;
 
     if (my_active_thread) {
         if (my_active_thread->status == STATUS_RUNNING) {
@@ -81,18 +81,18 @@ void sched_run(void)
 #ifdef SCHEDSTATISTICS
     unsigned long time = hwtimer_now();
 
-    if (my_active_thread && (pidlist[my_active_thread->pid].laststart)) {
-        pidlist[my_active_thread->pid].runtime_ticks += time - pidlist[my_active_thread->pid].laststart;
+    if (my_active_thread && (sched_pidlist[my_active_thread->pid].laststart)) {
+        sched_pidlist[my_active_thread->pid].runtime_ticks += time - sched_pidlist[my_active_thread->pid].laststart;
     }
 
 #endif
 
     DEBUG("\nscheduler: previous task: %s\n", (my_active_thread == NULL) ? "none" : my_active_thread->name);
 
-    if (num_tasks == 0) {
+    if (sched_num_threads == 0) {
         DEBUG("scheduler: no tasks left.\n");
 
-        while (!num_tasks) {
+        while (!sched_num_threads) {
             /* loop until a new task arrives */
             ;
         }
@@ -103,24 +103,24 @@ void sched_run(void)
     my_active_thread = NULL;
 
     while (!my_active_thread) {
-        int nextrq = number_of_lowest_bit(runqueue_bitcache);
-        clist_node_t next = *(runqueues[nextrq]);
+        int nextrq = bitarithm_lsb(runqueue_bitcache);
+        clist_node_t next = *(sched_runqueues[nextrq]);
         DEBUG("scheduler: first in queue: %s\n", ((tcb_t *)next.data)->name);
-        clist_advance(&(runqueues[nextrq]));
+        clist_advance(&(sched_runqueues[nextrq]));
         my_active_thread = (tcb_t *)next.data;
-        thread_pid = (volatile int) my_active_thread->pid;
+        sched_active_pid = (volatile int) my_active_thread->pid;
 #if SCHEDSTATISTICS
-        pidlist[my_active_thread->pid].laststart = time;
-        pidlist[my_active_thread->pid].schedules++;
-        if ((sched_cb) && (my_active_thread->pid != last_pid)) {
+        sched_pidlist[my_active_thread->pid].laststart = time;
+        sched_pidlist[my_active_thread->pid].schedules++;
+        if ((sched_cb) && (my_active_thread->pid != thread_last_pid)) {
             sched_cb(hwtimer_now(), my_active_thread->pid);
-            last_pid = my_active_thread->pid;
+            thread_last_pid = my_active_thread->pid;
         }
 #endif
 #ifdef MODULE_NSS
 
-        if (active_thread && active_thread->pid != last_pid) {
-            last_pid = active_thread->pid;
+        if (sched_active_thread && sched_active_thread->pid != thread_last_pid) {
+            thread_last_pid = sched_active_thread->pid;
         }
 
 #endif
@@ -128,17 +128,17 @@ void sched_run(void)
 
     DEBUG("scheduler: next task: %s\n", my_active_thread->name);
 
-    if (my_active_thread != active_thread) {
-        if (active_thread != NULL) {  /* TODO: necessary? */
-            if (active_thread->status ==  STATUS_RUNNING) {
-                active_thread->status =  STATUS_PENDING ;
+    if (my_active_thread != sched_active_thread) {
+        if (sched_active_thread != NULL) {  /* TODO: necessary? */
+            if (sched_active_thread->status ==  STATUS_RUNNING) {
+                sched_active_thread->status =  STATUS_PENDING ;
             }
         }
 
         sched_set_status((tcb_t *)my_active_thread,  STATUS_RUNNING);
     }
 
-    active_thread = (volatile tcb_t *) my_active_thread;
+    sched_active_thread = (volatile tcb_t *) my_active_thread;
 
     DEBUG("scheduler: done.\n");
 }
@@ -155,16 +155,16 @@ void sched_set_status(tcb_t *process, unsigned int status)
     if (status >= STATUS_ON_RUNQUEUE) {
         if (!(process->status >= STATUS_ON_RUNQUEUE)) {
             DEBUG("adding process %s to runqueue %u.\n", process->name, process->priority);
-            clist_add(&runqueues[process->priority], &(process->rq_entry));
+            clist_add(&sched_runqueues[process->priority], &(process->rq_entry));
             runqueue_bitcache |= 1 << process->priority;
         }
     }
     else {
         if (process->status >= STATUS_ON_RUNQUEUE) {
             DEBUG("removing process %s from runqueue %u.\n", process->name, process->priority);
-            clist_remove(&runqueues[process->priority], &(process->rq_entry));
+            clist_remove(&sched_runqueues[process->priority], &(process->rq_entry));
 
-            if (!runqueues[process->priority]) {
+            if (!sched_runqueues[process->priority]) {
                 runqueue_bitcache &= ~(1 << process->priority);
             }
         }
@@ -177,7 +177,7 @@ void sched_switch(uint16_t current_prio, uint16_t other_prio)
 {
     int in_isr = inISR();
 
-    DEBUG("%s: %i %i %i\n", active_thread->name, (int)current_prio, (int)other_prio, in_isr);
+    DEBUG("%s: %i %i %i\n", sched_active_thread->name, (int)current_prio, (int)other_prio, in_isr);
 
     if (current_prio >= other_prio) {
         if (in_isr) {
@@ -191,14 +191,14 @@ void sched_switch(uint16_t current_prio, uint16_t other_prio)
 
 NORETURN void sched_task_exit(void)
 {
-    DEBUG("sched_task_exit(): ending task %s...\n", active_thread->name);
+    DEBUG("sched_task_exit(): ending task %s...\n", sched_active_thread->name);
 
     dINT();
-    sched_threads[active_thread->pid] = NULL;
-    num_tasks--;
+    sched_threads[sched_active_thread->pid] = NULL;
+    sched_num_threads--;
 
-    sched_set_status((tcb_t *)active_thread,  STATUS_STOPPED);
+    sched_set_status((tcb_t *)sched_active_thread,  STATUS_STOPPED);
 
-    active_thread = NULL;
+    sched_active_thread = NULL;
     cpu_switch_context_exit();
 }
diff --git a/core/thread.c b/core/thread.c
index a2b838dfd79f6d54eb381e3f4c4155c40e336d0d..0a8d7c1bfa346299fbeefef1a4cc9e0222c79803 100644
--- a/core/thread.c
+++ b/core/thread.c
@@ -34,12 +34,13 @@
 
 inline int thread_getpid(void)
 {
-    return active_thread->pid;
+    return sched_active_thread->pid;
 }
 
 int thread_getlastpid(void)
 {
-    return last_pid;
+    extern int thread_last_pid;
+    return thread_last_pid;
 }
 
 int thread_getstatus(int pid)
@@ -67,7 +68,7 @@ void thread_sleep(void)
     }
 
     dINT();
-    sched_set_status((tcb_t *)active_thread, STATUS_SLEEPING);
+    sched_set_status((tcb_t *)sched_active_thread, STATUS_SLEEPING);
     eINT();
     thread_yield();
 }
@@ -85,7 +86,7 @@ int thread_wakeup(int pid)
         sched_set_status(other_thread, STATUS_RUNNING);
 
         restoreIRQ(old_state);
-        sched_switch(active_thread->priority, other_thread->priority);
+        sched_switch(sched_active_thread->priority, other_thread->priority);
 
         return 1;
     }
@@ -199,7 +200,7 @@ int thread_create(char *stack, int stacksize, char priority, int flags, void (*f
     cib_init(&(cb->msg_queue), 0);
     cb->msg_array = NULL;
 
-    num_tasks++;
+    sched_num_threads++;
 
     DEBUG("Created thread %s. PID: %u. Priority: %u.\n", name, cb->pid, priority);
 
@@ -220,7 +221,7 @@ int thread_create(char *stack, int stacksize, char priority, int flags, void (*f
         }
     }
 
-    if (!inISR() && active_thread != NULL) {
+    if (!inISR() && sched_active_thread != NULL) {
         eINT();
     }
 
diff --git a/cpu/arm_common/arm_cpu.c b/cpu/arm_common/arm_cpu.c
index 21b4d6c6c9feecaed72be3eef779b99067b6eed7..192508b8d972437956c6eff85aeb29447fbeff11 100644
--- a/cpu/arm_common/arm_cpu.c
+++ b/cpu/arm_common/arm_cpu.c
@@ -73,7 +73,7 @@ void thread_print_stack(void)
     asm("mov %0, sp" : "=r"(stack));
 
     register unsigned int *s = (unsigned int *)stack;
-    printf("task: %X SP: %X\n", (unsigned int) active_thread, (unsigned int) stack);
+    printf("task: %X SP: %X\n", (unsigned int) sched_active_thread, (unsigned int) stack);
     register int i = 0;
     s += 5;
 
diff --git a/cpu/arm_common/common.s b/cpu/arm_common/common.s
index ca97a64aa05735baeab61af98a70a0af61ea0723..96432a3deec452d81da675c3fbb22118d4c3e575 100644
--- a/cpu/arm_common/common.s
+++ b/cpu/arm_common/common.s
@@ -22,7 +22,7 @@
 
   /* External references */
 
-  .extern  active_thread
+  .extern  sched_active_thread
   .extern  sched_context_switch_request
   .extern  sched_run
   .extern  DEBUG_Routine
@@ -79,15 +79,15 @@ ctx_switch2:
     /* store return address and spsr on user mode stack */
     stmfd   lr!, {r0, r1}
 
-    /* save user mode stack pointer in *active_thread */
-    ldr     r1, =active_thread   /* r1 = &active_thread */
-    ldr     r1, [r1]                /* r1 = *r1 = active_thread */
+    /* save user mode stack pointer in *sched_active_thread */
+    ldr     r1, =sched_active_thread   /* r1 = &sched_active_thread */
+    ldr     r1, [r1]                /* r1 = *r1 = sched_active_thread */
 
     str     lr, [r1]                /* store stack pointer in tasks tcb*/
     /* now the calling task has all its registers saved on its stack and it's SP is saved in its tcb */
 
 
-    /* call scheduler so active_thread points to the next task */
+    /* call scheduler so sched_active_thread points to the next task */
     bl      sched_run
     b       task_return
     /* never coming back */
@@ -96,15 +96,15 @@ cpu_switch_context_exit:
     mov r0, #NOINT|SVCMODE
     msr cpsr, r0
 
-    /* call scheduler so active_thread points to the next task */
+    /* call scheduler so sched_active_thread points to the next task */
     bl      sched_run
 
     /* continue in task_return: */
 
 task_return:
     /* load tcb->stackpointer in r0 */
-    ldr     r0, =active_thread   /* r0 = &active_thread */
-    ldr     r0, [r0]                /* r0 = *r0 = active_thread */
+    ldr     r0, =sched_active_thread   /* r0 = &sched_active_thread */
+    ldr     r0, [r0]                /* r0 = *r0 = sched_active_thread */
     ldr     r0, [r0]
 
     /* restore saved spsr and return address from tasks stack */
diff --git a/cpu/arm_common/syscalls.c b/cpu/arm_common/syscalls.c
index 370fa9e6fee3055a2a2ff94f97544f4432ed7501..c483d8de836b026eeb0e206fe078ff926d6f1c8c 100644
--- a/cpu/arm_common/syscalls.c
+++ b/cpu/arm_common/syscalls.c
@@ -265,7 +265,7 @@ void _exit(int n)
 /*---------------------------------------------------------------------------*/
 int _getpid(void)
 {
-    return active_thread->pid;
+    return sched_active_thread->pid;
 }
 /*---------------------------------------------------------------------------*/
 int _kill_r(struct _reent *r, int pid, int sig)
diff --git a/cpu/cc430/cc430-gpioint.c b/cpu/cc430/cc430-gpioint.c
index 1ce15d4218d8430afd5858120e6ff12e539cdf19..f389c1697323e68478cc0565413c582f7e23d1c8 100644
--- a/cpu/cc430/cc430-gpioint.c
+++ b/cpu/cc430/cc430-gpioint.c
@@ -68,7 +68,7 @@ bool gpioint_set(int port, uint32_t bitmask, int flags, fp_irqcb callback)
 
     if ((port >= PORTINT_MIN) && (port <= PORTINT_MAX)) {
         /* set the callback function */
-        base = number_of_highest_bit(bitmask);
+        base = bitarithm_msb(bitmask);
 
         if (base >= 0) {
             cb[port - PORTINT_MIN][base] = callback;
diff --git a/cpu/cortexm_common/thread_arch.c b/cpu/cortexm_common/thread_arch.c
index 42c1d1beaa21a68dd523ee11ce95dcff5329542e..72cb003f8f10d7e28aa7e7af7ded643bcbb30187 100644
--- a/cpu/cortexm_common/thread_arch.c
+++ b/cpu/cortexm_common/thread_arch.c
@@ -143,8 +143,8 @@ void enter_thread_mode(void)
     __set_CONTROL(mode.w);
 
     /* load pdc->stackpointer in r0 */
-    asm("ldr    r0, =active_thread" );      /* r0 = &active_thread */
-    asm("ldr    r0, [r0]"           );      /* r0 = *r0 = active_thread */
+    asm("ldr    r0, =sched_active_thread" );      /* r0 = &sched_active_thread */
+    asm("ldr    r0, [r0]"           );      /* r0 = *r0 = sched_active_thread */
     asm("ldr    sp, [r0]"           );      /* sp = r0  restore stack pointer*/
     asm("pop    {r4}"               );      /* skip exception return */
     asm("pop    {r4-r11}"           );
@@ -189,14 +189,14 @@ __attribute__((always_inline)) static __INLINE void context_save(void)
     asm("stmdb  r0!,{r4-r11}"       );      /* save regs */
     asm("stmdb  r0!,{lr}"           );      /* exception return value */
 /*  asm("vstmdb sp!, {s16-s31}"     ); */   /* TODO save FPU registers if needed */
-    asm("ldr    r1, =active_thread" );      /* load address of current tcb */
+    asm("ldr    r1, =sched_active_thread" );      /* load address of current tcb */
     asm("ldr    r1, [r1]"           );      /* dereference pdc */
     asm("str    r0, [r1]"           );      /* write r0 to pdc->sp means current threads stack pointer */
 }
 
 __attribute__((always_inline)) static __INLINE void context_restore(void)
 {
-    asm("ldr    r0, =active_thread" );      /* load address of current TCB */
+    asm("ldr    r0, =sched_active_thread" );      /* load address of current TCB */
     asm("ldr    r0, [r0]"           );      /* dereference TCB */
     asm("ldr    r1, [r0]"           );      /* load tcb->sp to register 1 */
     asm("ldmia  r1!, {r0}"          );      /* restore exception return value from stack */
diff --git a/cpu/lpc1768/atom.c b/cpu/lpc1768/atom.c
index f4b0e4302150891fede8a699e2a3e546c200850e..d0a7ef2684f916f6308018cb29adb12a20c84346 100644
--- a/cpu/lpc1768/atom.c
+++ b/cpu/lpc1768/atom.c
@@ -48,7 +48,7 @@ void SVC_Handler(void)
 {
 	save_context();
 	asm("bl sched_run");
-	/* call scheduler update active_thread variable with pdc of next thread
+	/* call scheduler update sched_active_thread variable with pdc of next thread
 	 * the thread that has higest priority and is in PENDING state */
 	restore_context();
 }
@@ -70,19 +70,19 @@ void ctx_switch(void)
 	asm("mov r12, sp");
 	asm("stmfd r12!, {r4-r11}");
 
-	/* save user mode stack pointer in *active_thread */
-	asm("ldr     r1, =active_thread"); /* r1 = &active_thread */
-	asm("ldr     r1, [r1]"); /* r1 = *r1 = active_thread */
+	/* save user mode stack pointer in *sched_active_thread */
+	asm("ldr     r1, =sched_active_thread"); /* r1 = &sched_active_thread */
+	asm("ldr     r1, [r1]"); /* r1 = *r1 = sched_active_thread */
 	asm("str     r12, [r1]"); /* store stack pointer in tasks pdc*/
 
 	sched_task_return();
 }
-/* call scheduler so active_thread points to the next task */
+/* call scheduler so sched_active_thread points to the next task */
 NORETURN void sched_task_return(void)
 {
 	/* load pdc->stackpointer in r0 */
-	asm("ldr     r0, =active_thread"); /* r0 = &active_thread */
-	asm("ldr     r0, [r0]"); /* r0 = *r0 = active_thread */
+	asm("ldr     r0, =sched_active_thread"); /* r0 = &sched_active_thread */
+	asm("ldr     r0, [r0]"); /* r0 = *r0 = sched_active_thread */
 	asm("ldr     sp, [r0]"); /* sp = r0  restore stack pointer*/
 	asm("pop		{r4}"); /* skip exception return */
 	asm(" pop		{r4-r11}");
diff --git a/cpu/lpc1768/cpu.c b/cpu/lpc1768/cpu.c
index 505ff96d30fd9de181ab94291afad851d2514ec8..0c236c10ce3aac0453ca3f4ef29b4f0c79fe09c8 100644
--- a/cpu/lpc1768/cpu.c
+++ b/cpu/lpc1768/cpu.c
@@ -89,7 +89,7 @@ void save_context(void)
     asm("push   {LR}");
     /* save exception return value */
 
-    asm("ldr     r1, =active_thread");
+    asm("ldr     r1, =sched_active_thread");
     /* load address of currend pdc */
     asm("ldr     r1, [r1]");
     /* deref pdc */
@@ -99,7 +99,7 @@ void save_context(void)
 
 void restore_context(void)
 {
-    asm("ldr     r0, =active_thread");
+    asm("ldr     r0, =sched_active_thread");
     /* load address of currend pdc */
     asm("ldr     r0, [r0]");
     /* deref pdc */
diff --git a/cpu/lpc1768/syscalls.c b/cpu/lpc1768/syscalls.c
index 411ec00c8c0ebbecdb3be19908f2202ecd1240db..261019c943899c3e685b29fa60cd1efd9ed0906c 100644
--- a/cpu/lpc1768/syscalls.c
+++ b/cpu/lpc1768/syscalls.c
@@ -221,7 +221,7 @@ void _exit(int n)
 /*---------------------------------------------------------------------------*/
 int _getpid(void)
 {
-	return active_thread->pid;
+	return sched_active_thread->pid;
 }
 /*---------------------------------------------------------------------------*/
 int _kill_r(struct _reent *r, int pid, int sig)
diff --git a/cpu/lpc2387/gpioint/lpc2387-gpioint.c b/cpu/lpc2387/gpioint/lpc2387-gpioint.c
index 76513cc9430facf09db96047ceedd3a1969b2452..17f9f4cd9cbbc6bcc2829c11c7c7e7f608f2f042 100644
--- a/cpu/lpc2387/gpioint/lpc2387-gpioint.c
+++ b/cpu/lpc2387/gpioint/lpc2387-gpioint.c
@@ -61,7 +61,7 @@ gpioint_set(int port, uint32_t bitmask, int flags, fp_irqcb callback)
     volatile unsigned long *en_clr;
 
     /* lookup registers */
-    bit = number_of_highest_bit(bitmask);                       /* get irq mapping table index */
+    bit = bitarithm_msb(bitmask);         /* get irq mapping table index */
 
     switch(port) {
         case 0:                                                 /* PORT0 */
diff --git a/cpu/msp430-common/cpu.c b/cpu/msp430-common/cpu.c
index 36bb88ad85be012ff4f14f374528047997f5d9eb..cc2a5c3eeeb95d590bcb0a0c0a4dcb648d7a52e4 100644
--- a/cpu/msp430-common/cpu.c
+++ b/cpu/msp430-common/cpu.c
@@ -25,7 +25,7 @@ void thread_yield(void)
     __save_context();
 
     dINT();
-    /* have active_thread point to the next thread */
+    /* have sched_active_thread point to the next thread */
     sched_run();
     eINT();
 
@@ -34,7 +34,7 @@ void thread_yield(void)
 
 NORETURN void cpu_switch_context_exit(void)
 {
-    active_thread = sched_threads[0];
+    sched_active_thread = sched_threads[0];
     sched_run();
 
     __restore_context();
diff --git a/cpu/msp430-common/include/cpu.h b/cpu/msp430-common/include/cpu.h
index a4012e7ab43e518ca5e2b00b66570efddd3bdb38..6c1a4e614bf6bdc7ae1d369c74c91efc9d6ab411 100644
--- a/cpu/msp430-common/include/cpu.h
+++ b/cpu/msp430-common/include/cpu.h
@@ -57,12 +57,12 @@ inline void __save_context_isr(void)
     __asm__("push r5");
     __asm__("push r4");
 
-    __asm__("mov.w r1,%0" : "=r"(active_thread->sp));
+    __asm__("mov.w r1,%0" : "=r"(sched_active_thread->sp));
 }
 
 inline void __restore_context_isr(void)
 {
-    __asm__("mov.w %0,r1" : : "m"(active_thread->sp));
+    __asm__("mov.w %0,r1" : : "m"(sched_active_thread->sp));
 
     __asm__("pop r4");
     __asm__("pop r5");
diff --git a/cpu/native/irq_cpu.c b/cpu/native/irq_cpu.c
index 4803c440820b979edc5dff32d02f7349aad54bd5..c5ba92f8f6cc5d1bd106020c04e7afca43734b17 100644
--- a/cpu/native/irq_cpu.c
+++ b/cpu/native/irq_cpu.c
@@ -45,7 +45,7 @@
 #define ENABLE_DEBUG (0)
 #include "debug.h"
 
-extern volatile tcb_t *active_thread;
+extern volatile tcb_t *sched_active_thread;
 
 volatile int native_interrupts_enabled;
 volatile int _native_in_isr;
@@ -303,9 +303,9 @@ void native_isr_entry(int sig, siginfo_t *info, void *context)
     if (context == NULL) {
         errx(EXIT_FAILURE, "native_isr_entry: context is null - unhandled");
     }
-    if (active_thread == NULL) {
+    if (sched_active_thread == NULL) {
         _native_in_isr++;
-        warnx("native_isr_entry: active_thread is null - unhandled");
+        warnx("native_isr_entry: sched_active_thread is null - unhandled");
         _native_in_isr--;
         return;
     }
@@ -330,7 +330,7 @@ void native_isr_entry(int sig, siginfo_t *info, void *context)
     native_isr_context.uc_stack.ss_size = SIGSTKSZ;
     native_isr_context.uc_stack.ss_flags = 0;
     makecontext(&native_isr_context, native_irq_handler, 0);
-    _native_cur_ctx = (ucontext_t *)active_thread->sp;
+    _native_cur_ctx = (ucontext_t *)sched_active_thread->sp;
 
     DEBUG("\n\n\t\treturn to _native_sig_leave_tramp\n\n");
     /* disable interrupts in context */
diff --git a/cpu/native/native_cpu.c b/cpu/native/native_cpu.c
index a21e47f42fc4b09bbb641dd00d86124cce9f4c07..d9874ec9fa5ac8eb6eefc578d2dbb5cf85710285 100644
--- a/cpu/native/native_cpu.c
+++ b/cpu/native/native_cpu.c
@@ -54,7 +54,7 @@
 #define ENABLE_DEBUG (0)
 #include "debug.h"
 
-extern volatile tcb_t *active_thread;
+extern volatile tcb_t *sched_active_thread;
 
 ucontext_t end_context;
 char __end_stack[SIGSTKSZ];
@@ -129,12 +129,12 @@ void isr_cpu_switch_context_exit(void)
     ucontext_t *ctx;
 
     DEBUG("XXX: cpu_switch_context_exit()\n");
-    if ((sched_context_switch_request == 1) || (active_thread == NULL)) {
+    if ((sched_context_switch_request == 1) || (sched_active_thread == NULL)) {
         sched_run();
     }
 
-    DEBUG("XXX: cpu_switch_context_exit(): calling setcontext(%s)\n\n", active_thread->name);
-    ctx = (ucontext_t *)(active_thread->sp);
+    DEBUG("XXX: cpu_switch_context_exit(): calling setcontext(%s)\n\n", sched_active_thread->name);
+    ctx = (ucontext_t *)(sched_active_thread->sp);
 
     /* the next context will have interrupts enabled due to ucontext */
     DEBUG("XXX: cpu_switch_context_exit: native_interrupts_enabled = 1;\n");
@@ -150,7 +150,7 @@ void isr_cpu_switch_context_exit(void)
 void cpu_switch_context_exit(void)
 {
 #ifdef NATIVE_AUTO_EXIT
-    if (num_tasks <= 1) {
+    if (sched_num_threads <= 1) {
         DEBUG("cpu_switch_context_exit(): last task has ended. exiting.\n");
         exit(EXIT_SUCCESS);
     }
@@ -179,8 +179,8 @@ void isr_thread_yield(void)
     DEBUG("isr_thread_yield()\n");
 
     sched_run();
-    ucontext_t *ctx = (ucontext_t *)(active_thread->sp);
-    DEBUG("isr_thread_yield(): switching to(%s)\n\n", active_thread->name);
+    ucontext_t *ctx = (ucontext_t *)(sched_active_thread->sp);
+    DEBUG("isr_thread_yield(): switching to(%s)\n\n", sched_active_thread->name);
 
     native_interrupts_enabled = 1;
     _native_in_isr = 0;
@@ -191,7 +191,7 @@ void isr_thread_yield(void)
 
 void thread_yield(void)
 {
-    ucontext_t *ctx = (ucontext_t *)(active_thread->sp);
+    ucontext_t *ctx = (ucontext_t *)(sched_active_thread->sp);
     if (_native_in_isr == 0) {
         _native_in_isr = 1;
         dINT();
diff --git a/cpu/native/syscalls.c b/cpu/native/syscalls.c
index d94c15963829e883575340e472016acad42dd077..41fe2d88c965949b285b10ca2b5fcd43781c54f9 100644
--- a/cpu/native/syscalls.c
+++ b/cpu/native/syscalls.c
@@ -46,7 +46,7 @@
 #endif
 #include "debug.h"
 
-extern volatile tcb_t *active_thread;
+extern volatile tcb_t *sched_active_thread;
 
 ssize_t (*real_read)(int fd, void *buf, size_t count);
 ssize_t (*real_write)(int fd, const void *buf, size_t count);
@@ -74,12 +74,12 @@ void _native_syscall_leave(void)
             && (_native_in_isr == 0)
             && (_native_in_syscall == 0)
             && (native_interrupts_enabled == 1)
-            && (active_thread != NULL)
+            && (sched_active_thread != NULL)
        )
     {
         _native_in_isr = 1;
         dINT();
-        _native_cur_ctx = (ucontext_t *)active_thread->sp;
+        _native_cur_ctx = (ucontext_t *)sched_active_thread->sp;
         native_isr_context.uc_stack.ss_sp = __isr_stack;
         native_isr_context.uc_stack.ss_size = SIGSTKSZ;
         native_isr_context.uc_stack.ss_flags = 0;
diff --git a/cpu/sam3x8e/syscalls.c b/cpu/sam3x8e/syscalls.c
index 88895623aa0337e223578ff6899117713499a9a2..09f8aa711f02bac3202dc8783113c22dbef79898 100644
--- a/cpu/sam3x8e/syscalls.c
+++ b/cpu/sam3x8e/syscalls.c
@@ -99,7 +99,7 @@ caddr_t _sbrk_r(struct _reent *r, size_t incr)
  */
 int _getpid(void)
 {
-    return active_thread->pid;
+    return sched_active_thread->pid;
 }
 
 /**
diff --git a/drivers/cc110x/cc1100_phy.c b/drivers/cc110x/cc1100_phy.c
index 1a9761245f7bbfe65bb0b482730a06c00f945cd4..f09996be381c8c0493fd189dd9bcdcff89ec4c8a 100644
--- a/drivers/cc110x/cc1100_phy.c
+++ b/drivers/cc110x/cc1100_phy.c
@@ -197,9 +197,9 @@ void cc1100_phy_init(void)
 
 void cc1100_phy_mutex_lock(void)
 {
-    if (active_thread->pid != cc1100_mutex_pid) {
+    if (sched_active_thread->pid != cc1100_mutex_pid) {
         mutex_lock(&cc1100_mutex);
-        cc1100_mutex_pid = active_thread->pid;
+        cc1100_mutex_pid = sched_active_thread->pid;
     }
 }
 
diff --git a/sys/net/ccn_lite/ccn-lite-relay.c b/sys/net/ccn_lite/ccn-lite-relay.c
index 0a48fe65b503f1680f14df89a13c34c10c60b882..3cd15ac1ce8a0bb0146a6b2171a104d9b7fd9dd1 100644
--- a/sys/net/ccn_lite/ccn-lite-relay.c
+++ b/sys/net/ccn_lite/ccn-lite-relay.c
@@ -427,7 +427,7 @@ int ccnl_io_loop(struct ccnl_relay_s *ccnl)
 void ccnl_riot_relay_start(int max_cache_entries, int fib_threshold_prefix, int fib_threshold_aggregate)
 {
     ccnl_get_timeval(&theRelay.startup_time);
-    theRelay.riot_pid = thread_pid;
+    theRelay.riot_pid = sched_active_pid;
 
     DEBUGMSG(1, "This is ccn-lite-relay, starting at %lu:%lu\n", theRelay.startup_time.tv_sec, theRelay.startup_time.tv_usec);
     DEBUGMSG(1, "  compile time: %s %s\n", __DATE__, __TIME__);
diff --git a/sys/posix/pthread/pthread.c b/sys/posix/pthread/pthread.c
index 1a0f30d72c5d1ed957cb5b036a11cbcb2e16096b..704528860ea1b6b618449595ad3e6b03cbf11e76 100644
--- a/sys/posix/pthread/pthread.c
+++ b/sys/posix/pthread/pthread.c
@@ -158,7 +158,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
         return -1;
     }
 
-    sched_switch(active_thread->priority, PRIORITY_MAIN);
+    sched_switch(sched_active_thread->priority, PRIORITY_MAIN);
 
     return 0;
 }
@@ -217,7 +217,7 @@ int pthread_join(pthread_t th, void **thread_return)
 
     switch (other->status) {
         case (PTS_RUNNING):
-            other->joining_thread = thread_pid;
+            other->joining_thread = sched_active_pid;
             /* go blocked, I'm waking up if other thread exits */
             thread_sleep();
             /* no break */
@@ -265,7 +265,7 @@ pthread_t pthread_self(void)
 {
     pthread_t result = 0;
     mutex_lock(&pthread_mutex);
-    int pid = thread_pid; /* thread_pid is volatile */
+    int pid = sched_active_pid; /* sched_active_pid is volatile */
     for (int i = 0; i < MAXTHREADS; i++) {
         if (pthread_sched_threads[i] && pthread_sched_threads[i]->thread_pid == pid) {
             result = i+1;
diff --git a/sys/posix/pthread/pthread_barrier.c b/sys/posix/pthread/pthread_barrier.c
index 22165441b57c6e674bab3fce6ea11d595960c34b..9026ccc4cae1813e3a330542690c88712bb81e76 100644
--- a/sys/posix/pthread/pthread_barrier.c
+++ b/sys/posix/pthread/pthread_barrier.c
@@ -48,16 +48,16 @@ int pthread_barrier_wait(pthread_barrier_t *barrier)
 
     mutex_lock(&barrier->mutex);
     DEBUG("%s: hit a synchronization barrier. pid=%u\n",
-          active_thread->name, active_thread->pid);
+          sched_active_thread->name, sched_active_thread->pid);
 
     if (--barrier->count > 0) {
         /* need to wait for further threads */
 
         DEBUG("%s: waiting for %u threads. pid=%u\n",
-              active_thread->name, barrier->count, active_thread->pid);
+              sched_active_thread->name, barrier->count, sched_active_thread->pid);
 
         pthread_barrier_waiting_node_t node;
-        node.pid = thread_pid;
+        node.pid = sched_active_pid;
         node.next = barrier->next;
         node.cont = 0;
 
@@ -80,7 +80,7 @@ int pthread_barrier_wait(pthread_barrier_t *barrier)
         /* all threads have arrived, wake everybody up */
 
         DEBUG("%s: waking every other thread up. pid=%u\n",
-              active_thread->name, active_thread->pid);
+              sched_active_thread->name, sched_active_thread->pid);
 
         int count = 1; /* Count number of woken up threads.
                         * The first thread is the current thread. */
diff --git a/sys/posix/pthread/pthread_cond.c b/sys/posix/pthread/pthread_cond.c
index b27ff1d88b4b444255354d322f9a0de48931ee1f..e5647e9d0bb3d53ade36a89d4d45fc47f7b8fe9c 100644
--- a/sys/posix/pthread/pthread_cond.c
+++ b/sys/posix/pthread/pthread_cond.c
@@ -99,8 +99,8 @@ int pthread_cond_destroy(struct pthread_cond_t *cond)
 int pthread_cond_wait(struct pthread_cond_t *cond, struct mutex_t *mutex)
 {
     queue_node_t n;
-    n.priority = active_thread->priority;
-    n.data = active_thread->pid;
+    n.priority = sched_active_thread->priority;
+    n.data = sched_active_thread->pid;
     n.next = NULL;
 
     /* the signaling thread may not hold the mutex, the queue is not thread safe */
@@ -132,7 +132,7 @@ int pthread_cond_timedwait(struct pthread_cond_t *cond, struct mutex_t *mutex, c
     reltime = timex_sub(then, now);
 
     vtimer_t timer;
-    vtimer_set_wakeup(&timer, reltime, active_thread->pid);
+    vtimer_set_wakeup(&timer, reltime, sched_active_thread->pid);
     int result = pthread_cond_wait(cond, mutex);
     vtimer_remove(&timer);
 
@@ -157,7 +157,7 @@ int pthread_cond_signal(struct pthread_cond_t *cond)
     restoreIRQ(old_state);
 
     if (other_prio >= 0) {
-        sched_switch(active_thread->priority, other_prio);
+        sched_switch(sched_active_thread->priority, other_prio);
     }
 
     return 0;
@@ -191,7 +191,7 @@ int pthread_cond_broadcast(struct pthread_cond_t *cond)
     restoreIRQ(old_state);
 
     if (other_prio >= 0) {
-        sched_switch(active_thread->priority, other_prio);
+        sched_switch(sched_active_thread->priority, other_prio);
     }
 
     return 0;
diff --git a/sys/posix/pthread/pthread_rwlock.c b/sys/posix/pthread/pthread_rwlock.c
index f7033327c899ff0d4fff69cc7b71834cd2bb6c48..cb86f4637a9595e1993d3d9e7027ec7d50ec4e7a 100644
--- a/sys/posix/pthread/pthread_rwlock.c
+++ b/sys/posix/pthread/pthread_rwlock.c
@@ -81,7 +81,7 @@ bool __pthread_rwlock_blocked_readingly(const pthread_rwlock_t *rwlock)
     }
 
     queue_node_t *qnode = rwlock->queue.next;
-    if (qnode->priority > active_thread->priority) {
+    if (qnode->priority > sched_active_thread->priority) {
         /* the waiting thread has a lower priority */
         return false;
     }
@@ -122,11 +122,11 @@ static int pthread_rwlock_lock(pthread_rwlock_t *rwlock,
         /* queue for the lock */
         __pthread_rwlock_waiter_node_t waiting_node = {
             .is_writer = is_writer,
-            .thread = (tcb_t *) active_thread,
+            .thread = (tcb_t *) sched_active_thread,
             .qnode = {
                 .next = NULL,
                 .data = (uintptr_t) &waiting_node,
-                .priority = active_thread->priority,
+                .priority = sched_active_thread->priority,
             },
             .continue_ = false,
         };
@@ -200,7 +200,7 @@ static int pthread_rwlock_timedlock(pthread_rwlock_t *rwlock,
         timex_t reltime = timex_sub(then, now);
 
         vtimer_t timer;
-        vtimer_set_wakeup(&timer, reltime, active_thread->pid);
+        vtimer_set_wakeup(&timer, reltime, sched_active_thread->pid);
         int result = pthread_rwlock_lock(rwlock, is_blocked, is_writer, incr_when_held, true);
         if (result != ETIMEDOUT) {
             vtimer_remove(&timer);
@@ -315,6 +315,6 @@ int pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
     mutex_unlock(&rwlock->mutex);
 
     /* yield if a woken up thread had a higher priority */
-    sched_switch(active_thread->priority, prio);
+    sched_switch(sched_active_thread->priority, prio);
     return 0;
 }
diff --git a/sys/posix/semaphore.c b/sys/posix/semaphore.c
index df0825e1dba0479ef135b17c56c8a22add05dfdb..ec079fd24694f72e6f9ccde9a4d47007da456ecb 100644
--- a/sys/posix/semaphore.c
+++ b/sys/posix/semaphore.c
@@ -49,7 +49,7 @@ int sem_init(sem_t *sem, int pshared, unsigned int value)
 int sem_destroy(sem_t *sem)
 {
     if (sem->queue.next) {
-        DEBUG("%s: tried to destroy active semaphore.\n", active_thread->name);
+        DEBUG("%s: tried to destroy active semaphore.\n", sched_active_thread->name);
         return -1;
     }
     return 0;
@@ -77,15 +77,15 @@ int sem_unlink(const char *name)
 static void sem_thread_blocked(sem_t *sem)
 {
     /* I'm going blocked */
-    sched_set_status((tcb_t*) active_thread, STATUS_MUTEX_BLOCKED);
+    sched_set_status((tcb_t*) sched_active_thread, STATUS_MUTEX_BLOCKED);
 
     queue_node_t n;
-    n.priority = (uint32_t) active_thread->priority;
-    n.data = (size_t) active_thread;
+    n.priority = (uint32_t) sched_active_thread->priority;
+    n.data = (size_t) sched_active_thread;
     n.next = NULL;
 
     DEBUG("%s: Adding node to mutex queue: prio: %" PRIu32 "\n",
-          active_thread->name, n.priority);
+          sched_active_thread->name, n.priority);
 
     /* add myself to the waiters queue */
     queue_priority_add(&sem->queue, &n);
@@ -147,9 +147,9 @@ int sem_post(sem_t *sem)
     queue_node_t *next = queue_remove_head(&sem->queue);
     if (next) {
         tcb_t *next_process = (tcb_t*) next->data;
-        DEBUG("%s: waking up %s\n", active_thread->name, next_process->name);
+        DEBUG("%s: waking up %s\n", sched_active_thread->name, next_process->name);
         sched_set_status(next_process, STATUS_PENDING);
-        sched_switch(active_thread->priority, next_process->priority);
+        sched_switch(sched_active_thread->priority, next_process->priority);
     }
 
     restoreIRQ(old_state);
diff --git a/sys/ps/ps.c b/sys/ps/ps.c
index 30270b416125f9f83432262692b0c506fb07ae14..47c9491a1cf79d8f7c6609e6640576932b503375 100644
--- a/sys/ps/ps.c
+++ b/sys/ps/ps.c
@@ -60,8 +60,8 @@ void thread_print_all(void)
             const char *queued = &queued_name[(int)(state >= STATUS_ON_RUNQUEUE)]; // get queued flag
             int stacksz = p->stack_size;                                           // get stack size
 #if SCHEDSTATISTICS
-            double runtime_ticks =  pidlist[i].runtime_ticks / (double) hwtimer_now() * 100;
-            int switches = pidlist[i].schedules;
+            double runtime_ticks =  sched_pidlist[i].runtime_ticks / (double) hwtimer_now() * 100;
+            int switches = sched_pidlist[i].schedules;
 #endif
             overall_stacksz += stacksz;
             stacksz -= thread_measure_stack_free(p->stack_start);
diff --git a/sys/vtimer/vtimer.c b/sys/vtimer/vtimer.c
index 53f4f05aac0a2484f6db16670b7c95cbd74bd0e5..0ae9864e966334f7fe66a2f952223215679ba0b9 100644
--- a/sys/vtimer/vtimer.c
+++ b/sys/vtimer/vtimer.c
@@ -374,7 +374,7 @@ int vtimer_msg_receive_timeout(msg_t *m, timex_t timeout) {
     timeout_message.content.ptr = (char *) &timeout_message;
 
     vtimer_t t;
-    vtimer_set_msg(&t, timeout, thread_pid, &timeout_message);
+    vtimer_set_msg(&t, timeout, sched_active_pid, &timeout_message);
     msg_receive(m);
     if (m->type == MSG_TIMER && m->content.ptr == (char *) &timeout_message) {
         /* we hit the timeout */
diff --git a/tests/test_pthread_rwlock/main.c b/tests/test_pthread_rwlock/main.c
index 8b3b51d687136a1a61165e749d8d78eb11445feb..3cfca8d563246e5928c91da6a5f807f4362eb23d 100644
--- a/tests/test_pthread_rwlock/main.c
+++ b/tests/test_pthread_rwlock/main.c
@@ -55,7 +55,7 @@ static pthread_rwlock_t rwlock;
 static volatile unsigned counter;
 
 #define PRINTF(FMT, ...) \
-    printf("%c%u (prio=%u): " FMT "\n", active_thread->name[0], thread_pid, active_thread->priority, __VA_ARGS__)
+    printf("%c%u (prio=%u): " FMT "\n", sched_active_thread->name[0], sched_active_pid, sched_active_thread->priority, __VA_ARGS__)
 
 static void do_sleep(int factor)
 {
diff --git a/tests/test_queue_fairness/main.c b/tests/test_queue_fairness/main.c
index d8c9f63281dbea32cc7e042700dece44ec092348..014646471f2a6412eeead11f4b32c93a74a47b57 100644
--- a/tests/test_queue_fairness/main.c
+++ b/tests/test_queue_fairness/main.c
@@ -37,22 +37,22 @@ static int parent_pid;
 
 static void child_fun(void)
 {
-    printf("Start of %s.\n", active_thread->name);
+    printf("Start of %s.\n", sched_active_thread->name);
 
     for (int i = 0; i < NUM_ITERATIONS; ++i) {
         msg_t m;
         m.type = i + 1;
-        m.content.ptr = (void *) active_thread->name;
+        m.content.ptr = (void *) sched_active_thread->name;
         msg_send(&m, parent_pid, true);
     }
 
-    printf("End of %s.\n", active_thread->name);
+    printf("End of %s.\n", sched_active_thread->name);
 }
 
 int main(void)
 {
     puts("Start.");
-    parent_pid = thread_pid;
+    parent_pid = sched_active_pid;
 
     for (int i = 0; i < NUM_CHILDREN; ++i) {
         snprintf(names[i], sizeof (names[i]), "child%2u", i + 1);
diff --git a/tests/test_thread_msg_block_w_queue/main.c b/tests/test_thread_msg_block_w_queue/main.c
index e4b0edbfc238400bbafc5c3249258db7cf8cb14c..b39ee2125b2228a6000f461a745d06a83a28d91c 100644
--- a/tests/test_thread_msg_block_w_queue/main.c
+++ b/tests/test_thread_msg_block_w_queue/main.c
@@ -50,7 +50,7 @@ void thread1(void)
 int main(void)
 {
     msg_t msg;
-    p_main = thread_pid;
+    p_main = sched_active_pid;
 
     msg_t msg_q[1];
     msg_init_queue(msg_q, 1);
diff --git a/tests/test_thread_msg_block_wo_queue/main.c b/tests/test_thread_msg_block_wo_queue/main.c
index ca9470b1912792a59e1d416c89be93fb442d55ac..1c239d3581bfd1fc2b1b7e10c7a6efc3f6b473a3 100644
--- a/tests/test_thread_msg_block_wo_queue/main.c
+++ b/tests/test_thread_msg_block_wo_queue/main.c
@@ -50,7 +50,7 @@ void thread1(void)
 int main(void)
 {
     msg_t msg;
-    p_main = thread_pid;
+    p_main = sched_active_pid;
 
     p1 = thread_create(t1_stack, KERNEL_CONF_STACKSIZE_PRINTF, PRIORITY_MAIN - 1,
                        CREATE_WOUT_YIELD | CREATE_STACKTEST, thread1, "nr1");
diff --git a/tests/unittests/tests-core/tests-core-bitarithm.c b/tests/unittests/tests-core/tests-core-bitarithm.c
index 4c5965df0af4c1b7e49887114dba1fd80db4c7b7..c0f259f9b6faf5d2a1129b95fe360ec0873e8cee 100644
--- a/tests/unittests/tests-core/tests-core-bitarithm.c
+++ b/tests/unittests/tests-core/tests-core-bitarithm.c
@@ -140,58 +140,58 @@ static void test_CLRBIT_one_random(void)
     TEST_ASSERT_EQUAL_INT(0x00, res);
 }
 
-static void test_number_of_highest_bit_one(void)
+static void test_bitarithm_msb_one(void)
 {
-    TEST_ASSERT_EQUAL_INT(0, number_of_highest_bit(1));
+    TEST_ASSERT_EQUAL_INT(0, bitarithm_msb(1));
 }
 
-static void test_number_of_highest_bit_limit(void)
+static void test_bitarithm_msb_limit(void)
 {
     TEST_ASSERT_EQUAL_INT(sizeof(unsigned) * 8 - 1,
-                          number_of_highest_bit(UINT_MAX));
+                          bitarithm_msb(UINT_MAX));
 }
 
-static void test_number_of_highest_bit_random(void)
+static void test_bitarithm_msb_random(void)
 {
-    TEST_ASSERT_EQUAL_INT(2, number_of_highest_bit(4)); /* randomized by fair
+    TEST_ASSERT_EQUAL_INT(2, bitarithm_msb(4)); /* randomized by fair
                                                            dice roll ;-) */
 }
 
-static void test_number_of_lowest_bit_one(void)
+static void test_bitarithm_lsb_one(void)
 {
-    TEST_ASSERT_EQUAL_INT(0, number_of_lowest_bit(1));
+    TEST_ASSERT_EQUAL_INT(0, bitarithm_lsb(1));
 }
 
-static void test_number_of_lowest_bit_limit(void)
+static void test_bitarithm_lsb_limit(void)
 {
-    TEST_ASSERT_EQUAL_INT(0, number_of_lowest_bit(UINT_MAX));
+    TEST_ASSERT_EQUAL_INT(0, bitarithm_lsb(UINT_MAX));
 }
 
-static void test_number_of_lowest_bit_random(void)
+static void test_bitarithm_lsb_random(void)
 {
-    TEST_ASSERT_EQUAL_INT(3, number_of_lowest_bit(8)); /* randomized by fair
+    TEST_ASSERT_EQUAL_INT(3, bitarithm_lsb(8)); /* randomized by fair
                                                           dice roll ;-) */
 }
 
-static void test_number_of_bits_set_null(void)
+static void test_bitarithm_bits_set_null(void)
 {
-    TEST_ASSERT_EQUAL_INT(0, number_of_bits_set(0));
+    TEST_ASSERT_EQUAL_INT(0, bitarithm_bits_set(0));
 }
 
-static void test_number_of_bits_set_one(void)
+static void test_bitarithm_bits_set_one(void)
 {
-    TEST_ASSERT_EQUAL_INT(1, number_of_bits_set(1));
+    TEST_ASSERT_EQUAL_INT(1, bitarithm_bits_set(1));
 }
 
-static void test_number_of_bits_set_limit(void)
+static void test_bitarithm_bits_set_limit(void)
 {
     TEST_ASSERT_EQUAL_INT(sizeof(unsigned) * 8,
-                          number_of_bits_set(UINT_MAX));
+                          bitarithm_bits_set(UINT_MAX));
 }
 
-static void test_number_of_bits_set_random(void)
+static void test_bitarithm_bits_set_random(void)
 {
-    TEST_ASSERT_EQUAL_INT(3, number_of_bits_set(7)); /* randomized by fair
+    TEST_ASSERT_EQUAL_INT(3, bitarithm_bits_set(7)); /* randomized by fair
                                                         dice roll ;-) */
 }
 
@@ -212,16 +212,16 @@ Test *tests_core_bitarithm_tests(void)
         new_TestFixture(test_CLRBIT_null_one),
         new_TestFixture(test_CLRBIT_one_null),
         new_TestFixture(test_CLRBIT_one_random),
-        new_TestFixture(test_number_of_highest_bit_one),
-        new_TestFixture(test_number_of_highest_bit_limit),
-        new_TestFixture(test_number_of_highest_bit_random),
-        new_TestFixture(test_number_of_lowest_bit_one),
-        new_TestFixture(test_number_of_lowest_bit_limit),
-        new_TestFixture(test_number_of_lowest_bit_random),
-        new_TestFixture(test_number_of_bits_set_null),
-        new_TestFixture(test_number_of_bits_set_one),
-        new_TestFixture(test_number_of_bits_set_limit),
-        new_TestFixture(test_number_of_bits_set_random),
+        new_TestFixture(test_bitarithm_msb_one),
+        new_TestFixture(test_bitarithm_msb_limit),
+        new_TestFixture(test_bitarithm_msb_random),
+        new_TestFixture(test_bitarithm_lsb_one),
+        new_TestFixture(test_bitarithm_lsb_limit),
+        new_TestFixture(test_bitarithm_lsb_random),
+        new_TestFixture(test_bitarithm_bits_set_null),
+        new_TestFixture(test_bitarithm_bits_set_one),
+        new_TestFixture(test_bitarithm_bits_set_limit),
+        new_TestFixture(test_bitarithm_bits_set_random),
     };
 
     EMB_UNIT_TESTCALLER(core_bitarithm_tests, NULL, NULL, fixtures);