General performance and API fixes