Adapted schedule builder library to take priorities into account.