Fixed swap function
Adding a new function for the scheduler to update itself