Start of code for barriers.