extended the api to make it easier to use programmatically