Moved communication out of loop