I don't see any sort of question relating to a practical programming
problem here. That is, all indications are that your code works as you want it to. There's nothing for anyone to
solve. You can get advice on opinion-based things like best practices, coding conventions, techniques, etc. at codereview.stackexchange.com. If you choose to post a question there, please read their Tour carefully, and before you follow all guidelines, including providing a
complete code example. —
Peter Duniho 15 secs ago