Refactor the part of lessonplan releated function.