change two array loops giving me some troubles