support usage as a library