diff --git a/Unscramble/Output.hs b/Unscramble/Output.hs
--- a/Unscramble/Output.hs
+++ b/Unscramble/Output.hs
@@ -4,6 +4,8 @@
 
 import Control.Lens
 import qualified Data.HashMap as H
+import Data.List
+import Data.Ord
 import Text.Printf
 import Unscramble.Types
 
@@ -35,14 +37,15 @@
         = (putStrLn ("\n\27[1m" ++ word ++ "\27[0m: " ++ show sc) >>)
         . mapM_ (putStr . render) $ idxs
     where
-        idxs = [(a,b) | a <- [0..3], b <- [0..3]]
+        max' = fst . maximumBy (comparing fst) $ H.keys gs
+        idxs = [(a,b) | a <- [0..max'], b <- [0..max']]
         render n
             | head cs == n = "\27[44m" ++ pad letter n True ++ "\27[49m" ++ nl
             | n `elem` cs = "\27[107m" ++ pad letter n True ++ "\27[49m" ++ nl
             | otherwise = pad letter n False ++ nl
             where
                 letter = H.findWithDefault undefined n gs
-                nl = if snd n == 3 then "\n" else ""
+                nl = if snd n == max' then "\n" else ""
         pad [x] n t = " " ++ highlight [x] n t ++ " "
         pad x n t = ' ':highlight x n t
         highlight x n t
diff --git a/unscramble.cabal b/unscramble.cabal
--- a/unscramble.cabal
+++ b/unscramble.cabal
@@ -1,7 +1,7 @@
 Name:           unscramble
 Category:       Utils
 Synopsis:       Solve Boggle-like word games
-Version:        0.2
+Version:        0.3
 Description:    Solve Boggle-like word games
 License:        GPL
 Author:         Joel Taylor
