updated to use only public apis