Added more tests and refactored batch fetch