Pass loop to handler