add vcs repo
tidy up some code, add tests that were missed.