This is not written in javascript, it is ruby.
And I think your developer is way below average if he can't understand the pattern used in the refactored code.
You don't much sound like you are happy. You are in debt, you are still working for someone else, you can't make solid business-technical wise decisions based on merit. You think you come up with really really good? ideas. Maybe you are just a dreamer.