change $lastItem for $result as it was left when I copied this from my Facebook client.