refactored to reflec the API change