last version not working
attempt of different barrier that is probably slower =/