Refactor code managing the queue for fetching case info