added waitPending algorithm and corresponding changes to regElevator