completed second version of api