Add head and last functions