redesigning the API to be modular, thread-safe, and re-usable from within the same program