Added thread UOW and restarting, logging, and proper shutdown.