Updated to incorporate API changes