Added shortest time remaining first function and a copy function