More robust API. Example code