Improved API, documentation, added examples