refinements based on comments, better config handling