periodic boundary conditions. added touch events