added config option, refined logic and regexps. This behaves coherently now. :)