Fixed most of the flaws in pattern