can we have a timeout around this loop with a param (with default) in the signature to specify the time?