Changes concurrency pattern to have safer updating of variables
This is much cleaner