Hi,
I higly suggest you to check what alexandre quessy has done
in his muzaq abstractions and externals.
You are certainly going to make exactly the same thing.
http://alexandre.quessy.net/
http://muzaq.sourceforge.net/
patco.