Changes in API and small bug fixes