diff --git a/kattcmd/commands/compile.py b/kattcmd/commands/compile.py
index 6ae35a13afa10ab9dbadb53b1ea2d4149813aec2..aa623dd601f3eee30afc03312add2fb454bdce27 100644
--- a/kattcmd/commands/compile.py
+++ b/kattcmd/commands/compile.py
@@ -74,7 +74,8 @@ def CompileCpp(bus, problemname):
         return any(f.endswith(ending) for ending in endings)
 
     old_cwd = os.getcwd()
-    os.chdir(os.path.join(_GetBuildFolder(bus), problemname))
+    new_cwd = os.path.join(_GetBuildFolder(bus), problemname) 
+    os.chdir(new_cwd)
 
     output_binary = problemname
     input_files = ' '.join(filter(IsCppFile, files))
@@ -87,6 +88,9 @@ def CompileCpp(bus, problemname):
     for pattern, replacement in replacements:
         compile_command = compile_command.replace(pattern, replacement)
 
+    # If the binary exists already, recompile it
+    if os.path.exists(output_binary):
+        os.remove(output_binary)
     try:
         os.system(compile_command)
     except Exception as e:
@@ -104,7 +108,7 @@ def CompileCpp(bus, problemname):
         return relative_path
     else:
         os.chdir(old_cwd)
-        bus.call('kattcmd:compile:cpp-compile-failed', compile_command)
+        bus.call('kattcmd:compile:cpp-compile-failed', compile_command, new_cwd)
 
 
 def FindCppCompileCommand(bus):
@@ -139,8 +143,11 @@ def CLI(bus, parent):
     def OnCppCompiled(binary):
         click.echo('Placed binary at {}'.format(binary))
 
-    def OnCppCompileFailed(compile_command):
-        click.secho('Could not compile with "{}"'.format(compile_command), fg='red')
+    def OnCppCompileFailed(compile_command, directory):
+        directory = os.path.relpath(directory)
+        click.secho('Could not compile with "{}" in {}'.format(compile_command, directory), fg='red')
+        click.echo('Exiting')
+        exit(1)
 
     def OnPythonCompiled(paths):
         paths = list(map(os.path.relpath, paths))
diff --git a/kattcmd/commands/open.py b/kattcmd/commands/open.py
index 05542691466df018eb6176625df57bab10abbb9c..cc442efd3b144b83527a7df05359a4f4a865ee83 100644
--- a/kattcmd/commands/open.py
+++ b/kattcmd/commands/open.py
@@ -68,6 +68,14 @@ def CLI(bus, parent):
         relative = os.path.relpath(path)
         click.echo('Updated {} with information (date etc.)'.format(relative))
 
+    def OnTemplateAdded(folder, path):
+        if not path:
+            folder = os.path.relpath(folder)
+            click.secho('File already exists in {}'.format(folder))
+            click.secho('Did not overwrite it...')
+        else:
+            click.secho('Added {}'.format(path))
+        
     @click.command()
     @click.option('--force', type=bool, default=False, is_flag=True, help='Open a problem even if it does not exist on kattis.')
     @click.argument('name')
@@ -91,6 +99,9 @@ def CLI(bus, parent):
         bus.listen('kattcmd:testdownload:downloaded', OnTestsLoaded)
         bus.listen('kattcmd:testdownload:bad-status', OnTestFail)
         bus.listen('kattcmd:open:problem-doesnt-exist', OnProblemDoesntExist)
+        bus.listen('kattcmd:template:python-added', OnTemplateAdded)
+        bus.listen('kattcmd:template:cpp-added', OnTemplateAdded)
+
         if force:
             os.environ['FORCE_OPEN'] = '1'
 
@@ -102,11 +113,13 @@ def CLI(bus, parent):
 
         if preference == 'python':
             path = bus.call('kattcmd:template:python', bus, target)
-            bus.call('kattcmd:template:add-info', bus, path)
+            if path:
+                bus.call('kattcmd:template:add-info', bus, path)
 
         elif preference == 'cpp':
             path = bus.call('kattcmd:template:cpp', bus, target)
-            bus.call('kattcmd:template:add-info', bus, path)
+            if path:
+                bus.call('kattcmd:template:add-info', bus, path)
 
         else:
             raise ValueError('Bad template preference, check "template-type" in your ' + \
diff --git a/kattcmd/commands/template.py b/kattcmd/commands/template.py
index b28cb77f28c5bb5f71c1c273ca6a01f49d86dc81..8892c0d9979085dfaa6dbccb82a78a629cf46ff6 100644
--- a/kattcmd/commands/template.py
+++ b/kattcmd/commands/template.py
@@ -19,8 +19,11 @@ def _AddTemplate(templatename, extname, folder):
     template = os.path.join(_GetTemplateFolder(), templatename)
     problemname = os.path.basename(folder) + extname
     templatepath = os.path.join(folder, problemname)
-    shutil.copyfile(template, templatepath)
-    return templatepath
+    if not os.path.exists(templatepath):
+        shutil.copyfile(template, templatepath)
+        return templatepath
+    else:
+        return None
 
 
 def _ReplaceInFile(fpath, pattern, value):
@@ -76,7 +79,7 @@ def AddGeneralizedTemplate(bus, topic, folder, default, defaultname, fileending)
         path = HandleDefault()
     else:
         path = HandleCustom()
-
+    
     bus.call(topic, folder, path)
     return path
 
diff --git a/kattcmd/commands/test.py b/kattcmd/commands/test.py
index 0c49a2356fcbeddfd36560f13098c8367793f095..68cf3c88a9b799d0e038bde90d5d7f162ee6aee6 100644
--- a/kattcmd/commands/test.py
+++ b/kattcmd/commands/test.py
@@ -66,8 +66,9 @@ def CLI(bus, parent):
     def OnCppCompiled(binary):
         click.secho('Cpp compiled successfully and put in {}'.format(binary))
 
-    def OnCppFailed(compile_command):
-        click.secho('Could not compile using: "{}"'.format(compile_command), fg='red')
+    def OnCppFailed(compile_command, directory):
+        directory = os.path.relpath(directory)
+        click.secho('Could not compile using: "{}" in {}'.format(compile_command, directory), fg='red')
         click.secho('Exiting')
         exit(1)
 
diff --git a/kattcmd/main.py b/kattcmd/main.py
index ce73a70fcafed9cb528ec63ed6307e513062fc4b..f69b59369f37c043251fff801e7100147aa144c8 100644
--- a/kattcmd/main.py
+++ b/kattcmd/main.py
@@ -46,15 +46,18 @@ def main():
         if hasattr(plugin, 'CLI'):
             plugin.CLI(the_bus, cli_main)
 
-    cli_main()
 
-
-if __name__ == '__main__':
     try:
-        main()
+        home = the_bus.call('kattcmd:find-root', the_bus)
     except Exception as e:
-        print(dir(e))
+        click.echo('It seems that you are not in a kattis directory =/')
         if hasattr(e, 'message'):
-            print(e.message)
+            click.echo(e.message)
         else:
-            print(e)
+            click.echo(str(e))
+    else:
+        cli_main()
+
+
+if __name__ == '__main__':
+    main()