Add basic thread example
Clean up some code by using static inner classes