Modified methods buildPattern(). Added test cases and fully tested it. Added to utilities methods in Learner class.