Updated with priority scheduler