Fixes and API improvements