queryRepos working fine, refactored some repeated code