do some refinements, need to test more