Added context-switching and a yield() function.