adapted function to new API format