diff --git a/src/main/java/dotsandboxes/DotsAndBoxesGrid.java b/src/main/java/dotsandboxes/DotsAndBoxesGrid.java
index 32667af6c63a0287bd4f91c37682acb30c08e9a4..08591b603ff2683463448a5012cc121490f16a6a 100644
--- a/src/main/java/dotsandboxes/DotsAndBoxesGrid.java
+++ b/src/main/java/dotsandboxes/DotsAndBoxesGrid.java
@@ -107,13 +107,20 @@ public class DotsAndBoxesGrid {
      * @return true if all four sides have been drawn.
      */
     public boolean boxComplete(int x, int y) {
-        if (x >= width - 1 || x < 0 || y >= height - 1 || y < 0) {
-            return false;
-        }
-
-        // A box is complete if the north and south horizontals and the east and west verticals have all been drawn.
-        // FIXME: You'll need to fix this code (after writing a test first).
-        return true;
+            if (x >= width - 1 || x < 0 || y >= height - 1 || y < 0) {
+                return false;
+            }
+            else if (this.getVertical(x,y) == true && this.getVertical(x + 1, y) == true) {
+                if (this.getHorizontal(x,y) == true && this.getHorizontal(x, y + 1) == true) {
+                    return true;
+                }
+            }
+            else {
+                return false;
+            }
+
+        // A box is complete if the north and south horizontals and the east and west verticals have all been drawn
+    return false;
     }
 
     /** Tries to claim a box for a player. If the box is complete, sets the ownership and returns true. */
@@ -142,7 +149,12 @@ public class DotsAndBoxesGrid {
 
         // FIXME: You need to throw an exception if the line was already drawn.
 
-        this.horizontals[x][y] = true;
+        if (this.horizontals[x][y] == true) {
+            throw new RuntimeException("Line already here");
+        }
+        else {
+            this.horizontals[x][y] = true;
+        }
 
         // Try to claim the north or south boxes
         boolean claimN = claimBox(x, y-1, player);
diff --git a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
index 763162700303b93f02056b0ddf5f9992634923ea..8c32f365c535133f51906f0e2d1153158ec7eaab 100644
--- a/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
+++ b/src/test/java/dotsandboxes/DotsAndBoxesGridTest.java
@@ -35,12 +35,12 @@ public class DotsAndBoxesGridTest {
     public void completeBoxTest() {
         logger.info("Test to see if completion algorithm is working");
 
-        DotsAndBoxesGrid grid = new DotsAndBoxesGrid(4,2,2);
+        DotsAndBoxesGrid grid = new DotsAndBoxesGrid(4,3,2);
         // draw a complete square
         grid.drawHorizontal(1,1,1);
-        grid.drawHorizontal(1,2,1);
-        grid.drawVertical(1,2,1);
-        assertTrue(grid.drawVertical(2,2,1));
+        grid.drawHorizontal(1,2,2);
+        grid.drawVertical(1,1,1);
+        assertTrue(grid.drawVertical(2,1,1));
     }
 
     // Test that DotsAndBoxesGrid currently allows drawing a line on an existing line