Function to get last