Bug fixes. API restructuring.