diff --git a/src/main/java/uk/ac/rhul/cs/javatester/SubmissionWrapper.java b/src/main/java/uk/ac/rhul/cs/javatester/SubmissionWrapper.java
index eba08945a1b10a327e7388cc36a0941e6a25f0cf..03a88bf4ce39f6d6db7bed9af252af95392c06d2 100644
--- a/src/main/java/uk/ac/rhul/cs/javatester/SubmissionWrapper.java
+++ b/src/main/java/uk/ac/rhul/cs/javatester/SubmissionWrapper.java
@@ -65,6 +65,7 @@ public class SubmissionWrapper implements AutoCloseable {
     }
 
     private static final int TIMEOUT = 2; // seconds
+    private static final int FLUSH_TIMEOUT = 5; // seconds
 
     // use getLine to get output, don't use these directly
     private Process process;
@@ -604,7 +605,9 @@ public class SubmissionWrapper implements AutoCloseable {
      */
     private void shutdownProcess() {
         try {
-            process.waitFor(TIMEOUT, TimeUnit.SECONDS);
+            boolean exited = process.waitFor(TIMEOUT, TimeUnit.SECONDS);
+            if (!exited)
+                process.destroyForcibly();
         } catch (InterruptedException e) {
             // make sure it's really shutdown
             process.destroyForcibly();
@@ -617,7 +620,7 @@ public class SubmissionWrapper implements AutoCloseable {
     private void flushOutputStreams() {
         getLinesFromStderr();
         getLinesFromStdout();
-    }
+     }
 
     /**
      * Get as many lines as possible from the submission stdout
@@ -627,8 +630,9 @@ public class SubmissionWrapper implements AutoCloseable {
     private void getLinesFromStdout() {
         try {
             String line;
-            while ((line = getLine()) != null)
+            while ((line = getLine()) != null) {
                 outputLines.add(line);
+            }
         } catch (TimeoutException e) {
             // do nothing
         }
@@ -665,6 +669,8 @@ public class SubmissionWrapper implements AutoCloseable {
             });
         } catch (TimeoutException e) {
             // do nothing
+        } catch (InterruptedException e) {
+            // do nothing
         } catch (Exception e) {
             System.err.println("Something failed badly awaiting response.");
             System.err.println(e);