More cleanup, adds logic for bare repos