fixed register saving and stack overflow checking
implemented a better multitasking technique