added support for more advanced directives
improved output tags