head and tail modified