Refactor code to remove repetitive tasks. Add untested git-server middleware.