Add support for custom operations run in the internal thread
add some comments