Threads - variables and exceptions