made repository method more reusable by making branch a parameter