Fixed bug of checking out the same branch multiple times and code review fixes