Added loop with callback function.