Implement preliminary clone support. Some other misc stuff I forgot to do individual commits for.