Added a Main() function so that this can be put in a thread