Add kernel scheduling stuff, added task state and some mild cleaning.
test