adding pattern to the tail