improve immutability of Pattern and add some doc