updated logic in repository