API changes, cleanups and performance improvements