Maybe use a simpel mutex, but otherwise working