Change formatting
Protect name changes with mutex
Move get_image to capture thread
Reorder cleanup for thread safety