Adjusted to API changes