using cleanup handlers for thread