API and tests improvements