cleaning up a bit, trying to get around needing to use a mutex in this threaded app