implemented concurrency, things now should be thread safe.