Some API improvements
Add example of using API in batch mode