initial version, still some refinements needed