Adapted to the new API