Refactored to not clone if a different branch is specified