Added quicker min() determination of lowest ID