sequential implementation of scan_plus