Coded the whole plugin.

Not sure if it works yet, testing now.