apattern and bpattern done!