added comments, fix patterns