Added split code into two functions, added error checking if repository name is taken already.