Have you considered using hooks?
Yes, I am trying to get you to do the work while I just drop suggestions.