Fixes and general API improvements