moved var friendImage outside the function.