 			}
 			else {
 				if count >= 0 && count < coordlist.count {
-					let col = coordlist[count][0]
-					let row = coordlist[count][1]
-					let vertical = coordlist[count][2]
-
-					if coordlist[count][4] > 0 {
+					let col = coordlist[count].0
+					let row = coordlist[count].1
+					let vertical = coordlist[count].2
+
+					if coordlist[count].4 > 0 {
 						fit = true
 						setWord(col, r: row, vertical: vertical, word: word, force: true)
 					}

		self.grid = Array2D(columns: columns, rows: rows, defaultValue: "-")
	}
	
	func generate() {
		
		availableWords.sortInPlace({$0.lengthOfBytesUsingEncoding(NSUTF8StringEncoding) > $1.lengthOfBytesUsingEncoding(NSUTF8StringEncoding)})
		


import Foundation

public class CrosswordsGenerator {

	private var columns: Int = 0
	private var rows: Int = 0
	private var grid: Array2D<String>?
	private var maxLoops: Int = 0
	private var availableWords: Array<String> = Array()
	private var currentWordList: Array<String> = Array()
	
	public struct Word {
		var word = ""
		var col = 0
		var row = 0
		var vertical = 0
	}
	
	public init(columns: Int, rows: Int, maxLoops: Int = 2000, words: Array<String>) {
		self.columns = columns
		self.rows = rows
		self.maxLoops = maxLoops
