removed test outputs and corrected array indexing issues