chap 10: more logic
updated replsf function, added more patterns