Updated with the new SDK api