Simplify plugin by using existing plugins

I've rewritten the plugin entire, now utilizing existing plugins, such as `concat`, `header` and `footer`. At least in my tests this works precisely as before, just with less code and complexity.