Adding 'exit' and thread handling comments