head and tail basic functionality done