Updated to use newer api calls