Made small API improvements and fixes.