unique_ptr some stuff, free resources, proper thread termination