Adding lots of tests

Still TODO (probably in a subsequent pull request) - add integration tests (i.e. test again a real repo)