Updated for latest API changes