added a tag callback for more advanced extraction, allow to set reges
compilation flags, some code improvements to avoid repetitions