replaced infinite while loop with a Thread.Join()
fixed some formatting and comments