Added extra grid dimension and updated to work with word lengths