Fix for the extra conflict markers and some Runner and Repository refactoring

Added a test case and a fix for the excessive conflict marking.
I have also included 2 refactoring commits that I had already written when I noticed the bug.
@nesquena if you are not comfortable merging these together, let me know and I can make another PR.