Added periodic boundary conditions