Refactoring codes: fetch result from tuple to dict.