Add function to get last element of a list.