Updating API, and added theoretical example.