Update for API changes and remove pointless and wrong code from the last commit