added doc file and serveral improvements to apis