I appreciate your interest but this section is to rewrite working code for better readability and scalability.
This code was written by Yisrael and i don’t think it need to be refactor.
regarding the question, i see you already post this question on Yisrael post
Create a new post and tag me there