moved validateChapter function and created chapterText variable