Cleanup code, no functional chanegs
Added yielding to set priority