greatly simplified boolean logic. added shortestRemainingTime