Added some code so the map loops if needed