Add pull and branching logic to pull script