Made compatible with the latest API