Updated to work with API changes