Lots of fixes + API changes