first pass at head and tail functions