Change Sys_Yield to Sys_Sleep
Add safety checks